I use PuTTY to connect to a UNIX server with several sites with the same user login. So I use several PuTTY connection with SSH - Remote command as
cd /var/www/path_to_the_site ; /bin/bash
It works fine, besides some CentOS commands are unknown. E.g.:
$ service
bash: service: command not found
If I've logged in without "remote command", everything is fine, the command exists:
$ service
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]
What is wrong with "/bin/bash" executing, it can't find some commands?
I use the same login, so I can't just set home directory for user. E.g. in WinSCP plugin in FAR I can set initial directory for any connection and it works fine.
Try adding the --login
option:
cd /var/www/path_to_the_site ; /bin/bash --login
That makes bash behave as if it were a login shell, which means that it reads the files /etc/profile
and ~/.profile
- I suspect one of those files sets up the path as needed to invoke service
.