I would like ssh, sudo su and umount /home and run diagnostic on it. Is there a runlevel I can used to close X and other process using /home while keeping network access? Or another way?



First, log out all user manually, then ssh with root.

Use "lsof | grep home" to find remaining process that use /home and kill them all.

You can umount.


/home is only typically in use when users are logged in. The root user has a /root home specifically so the root user is not dependent upon additional mount points.

Enable root SSH login

For Ubuntu this means you need to give root a password in order to login via ssh:

https://help.ubuntu.com/community/RootSudo#Enabling the root account

Consider that the root account may be disabled from SSH access by default, verify the setting in /etc/ssh/sshd_config:

PermitRootLogin yes

Logoff users and prevent new logins

To kick users off in a multi-user environment one would normally change to the single-user run level 1. However this is pretty much a console or serial port only task as sshd by default is configured only for run levels 2, 3, 4, and 5, and that you will likely lose your ssh connection.


The not so great alternative is judicious use of killall --user but has to be applied to each and every user. Only the login (pseudo) terminal process needs to be killed and a more refined approach can be taken, for example:

skill -KILL -v /dev/pts/*

The next problem is prevent users immediate sign back in. You can create the file /etc/nologin to prevent user logins, you need to ensure pam_nologin.so is enabled on Linux for all PAM methods such as SSH:


This is also provided by the shutdown -k command:

-k Only send out the warning messages and disable logins, do not actually bring the system down.


You can unmount /home.

  • Instead of giving root a password, I gave it a public key. It allow to log the same way. Aug 29 '11 at 5:10
  • However, telinit 1 also close the ssh connection and prevent connecting back. Aug 29 '11 at 5:12
  • Unless we can configure sshd to run in level 1, it is just trouble going there. Aug 29 '11 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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