We have a linux system ferguson.

On ferguson:
  • I have user id a123.
  • As user id a123, I am able to sudo su into userid admin.
  • There is no direct login for the userid admin.
  • We have to use our personal userids to sudo su into userid admin.
I have a virtual box linux vm on my windows laptop.
  • From my laptop's linux vm, I am able to use userid a123 to sshfs mount a123@ferguson.
  • I would like to sshfs mount as admin@ferguson.
  • But admin@ferguson can only be accessed thro sudo su.

How can my laptop's linux vm use userid a123 perform sshfs mount ferguson as admin, using sudo access ?


1 Answer 1


I'm assuming the only reason you can't just directly connect via ssh to ferguson as the user admin is simply because either no password is set for admin or you just simply don't know it. There could be other reasons for this not working, such as no login shell.

The best solution for this is to use SSH keys.

On your Linux VM, if you haven't already, generate a public/private key pair: $ ssh-keygen -t rsa. Follow the prompts, and accept the default locations. It is suggested to set a passphrase on the private key to protect it.

You will now have a public key you can use under ~/.ssh/id_rsa.pub.

On ferguson, change to the admin account like you normally do. If the file ~/.ssh/authoized_keys does not exist, you'll need to create it first. Permissions are important, and SSH won't allow access if they're not correct.

$ mkdir -p ~/.ssh
$ chmod 0700 ~/.ssh
$ touch ~/.ssh/authorized_keys
$ chmod 0600 ~/.ssh/authorized_keys

You will then need to copy your public key into one line in authorized_keys. If this file already exists, there will likely be other keys. Put your key on its own line.

You should now be able utilize sshfs as the user admin. In fact, if admin has a suitable login shell already set (such as /bin/bash), you will even be able open an ssh session as admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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