Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I missinput a command in a directory (I don't remember what it is. Maybe it's in my home/user/, or in the / directory) in Ubuntu Linux.

sudo rm -f -r tmp

After that, when I restart and log in, I cannot login when I use that user. The system says some config file is missing for some apps I don't know in Gnome.

However, I can log in with user root.

Can I resolve the problem?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

As root, do this:

# mkdir /tmp
# chmod o+t,ugo+rw /tmp
share|improve this answer

Thanks a lot Dennis Williamson! Just in order to make the answer more detailed:

While you are in the login screen, hit Ctrl+Alt+F1 (do it in the same order) to switch to the command mode interface. From there you can login with your username and passwrod. then run:

# sudo apt-get update
# sudo apt-get upgrade
# sudo rm -Rf /tmp
# mkdir /tmp #or if it didn't work run: sudo mkdir /tmp
# sudo chmod o+t,ugo+rw /tmp
# exit

Then restart your computer. It worked for me :)

You may also have a look here.

share|improve this answer

I would like to add more information about this problem, since it bugged me for many hours. I would never imagine that directory /tmp is so important in Ubuntu.

You can also spot this problem if you open the file (/var/log/auth.log) and search for some lines similar to these:

Jan 18 01:55:12 localhost **gnome-keyring-daemon**[2016]: couldn't create socket directory: **Permission denied**
Jan 18 01:55:12 localhost gnome-keyring-daemon[2016]: couldn't bind to control socket: /tmp/keyring-mKRg6t/control: **No such file or directory**
Jan 18 01:55:12 localhost lightdm: pam_unix(lightdm:session): session closed for user <your_username>

This must have happened because you probably changed the permissions of directory /tmp. And this is why you could login with root and not with other users. As Dennis Williamson wrote this command (sudo chmod o+t,ugo+rw /tmp) sets the correct permissions (drwxrwxrwt)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.