On Mon, Nov 01, 2010 at 12:20:04PM +0000, Brett Parker wrote:
On 01 Nov 12:04, Chris G wrote:
I'd like to set up some logins to various places around my LAN which not only ssh to the relevant place but also do a cd to a specific directory.
OK - so is this key dependant or user dependant?
Neither.
Can anyone suggest a way to do this? By default if you give a command to ssh at the end of the line then it executes that command and then closes the connection - it only keeps the connection open if there is no command at the end. In addition doing a cd is even a bit more difficult because it's no use at all to execute it in a sub-shell.
Well, you could always create multiple users with the same uid/gid and make it so that their $HOME is set to the directory you want it to go to, that'd be a fairly typical workaround.
What I actually want to do at this particular moment is log onto my web server as www-data and change to different directories according to what I want to edit, e.g. :-
'info' - logs me on to the server as www-data and takes me to /var/www/info 'boat' - logs me on to the server as www-data and takes me to /var/www/boat etc.
Yes, I know it's rather trivial, but I find this sort of thing very useful.