Switching to a non-shell user

Hi all,

I’ve just signed up for a DreamHost account and I’m in the process of setting everything up. I’ve created separate users for separate areas of my site, but as the “master user” I’d like to be able to access the other home directories via the shell, even though those accounts don’t have shell access (SFTP only.)

Normally I would just "su " but this doesn’t work - it just freezes after I type in my password. I’m guessing this is because the users are SFTP only, so ‘su’ is succeeding but running the SFTP shell instead. I thought I could do something like "su -s /bin/bash " to get around this by loading a different shell, but apparently not.

Is there any way I can switch users through the shell even if those users don’t have shell access?


Uh, no. Those users don’t have shell access. The su command is just a way for you to log in as them. Why not enable shell access for them?

Otherwise, your best bet is this set of hoops:


Ah ok, yes I was looking at that group set up - but I need to log in once as each user to set that up. I suppose I’ll have to grant them shell access, tweak the groups, then revoke access again.

I don’t want to grant these users shell access permanently because I’m paranoid :slight_smile:

So are these users treated differently then? I thought ‘su’ just changed the current user’s UID regardless of their shell, and since these users all have UIDs I thought it would work (since I was logged in with a shell-enabled user initially.)

You can su between users to become that user within the space you were currently in.

cd ~ will put you in the new user root space.

exit will return you to your original login.

Maximum Cash Discount on any plan with MAXCASH