I've painted myself into a corner:

My machines each have only sudo user which is local to the machine. I setup an autofs to mount over top of /home; the mount does not include a folder for the sudo user.

I can't log in to the machines to change the sudo user's home directory, nor add a different user (who does have a /home directory to the sudo group).

Is there any way to execute a command over ssh without having a home directory. Alternatively, I can log in as a non sudo user, so is it possible to execute a command using su without a home directory?

  • Does ssh user@host dash work? It should say nothing and wait for input, after which you can run ls to see if commands work. If that works, you can try sudo echo hi to see if sudo is working. – Chai T. Rex Jan 27 '18 at 0:04
  • No, as soon as it logs in I receive Creating directory '/home/ssdrive'. Unable to create and initialize directory '/home/ssdrive'. Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-31-generic x86_64) ... – sheridp Jan 27 '18 at 0:07
  • Does it sit there waiting for input after the welcome message? If so, try sudo echo hi. – Chai T. Rex Jan 27 '18 at 0:09
  • No, it immediately closes the session. – sheridp Jan 27 '18 at 0:12
  • 1
    OK glad you got it fixed - please consider adding that as an answer – steeldriver Jan 27 '18 at 0:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.