Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Due to a breach of security, the administrators of the work server have implemented a new method of security. To log into the server, we must log in as our own user (which has severely limited permissions), then su into another user under which we can do development (which we cannot log in to from the outside).

It used to be that we just logged in to a common user which had permissions, and I could simply mount the remote filesystem right onto my local filesystem using sshfs. Now that we have to su into another user, I can't simply mount it like I have before.

I've done a reasonable amount of research and tried all "solutions" I found. I've been trying to make this work for some time.

My question is: is there a way to su into a different user inside a sshfs mount? Perhaps running a script on the server after the mount completes or something?

I would use something like this, but I don't have sudo access on the server, only su.

As a side note, my development computer is running LM11, and I'm mounting a share on some old Red Hat server.

share|improve this question
add comment

migrated from stackoverflow.com Jan 17 '12 at 0:24

This question came from our site for professional and enthusiast programmers.

1 Answer

sshfs supports specifying the sftp server to use. So copy the normal sftp binary to some path (like the home dir), setuid the binary with chmod u+s, and pass -o sftp_server=/path/to/sftp to sshfs.

Example, devuser is the shared account, and myuser is your account

devuser@remote # cp `which sftp` ~/
devuser@remote # chmod u+s ~/sftp
myuser@local # sshfs myuser@remote:/mount/source /mount/point -o sftp_server=/home/devuser/sftp

You'll want to lock it down though, so do something like chmod 750 /home/devuser and make sure your user is in the group owning /home/devuser. You could also copy the sftp binary to your own directory and lock your home directory down.

share|improve this answer
add comment

Your Answer

 
discard

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