To facilitate my work. I add
cd $working_dir
sudo su
in ~/.bashrc file.
then I could login as root and in my working dir.
But when I need run a command from remote through ssh, It is just blocked (seems like su ran and waited for an input, but I didn't get a shell).
So, the problem is:
How can I login with dir changing to working-dir and with root privilege automatically and without ssh cmd blocked?
I use pstree -a, blocked process tree shown as this:
| `-sshd
| `-sshd
| `-kbash -c pstree\040-a
| `-sudo su
| `-su
| `-kbash
case $- in (*i*) ;; (*) return ;; esacto exit ~/.bashrc before running the su might help. The big question is when you ssh into this box do you want to be root? If so why bother logging in as a normal user and just go directly in as root?.bashrcfor automatically switching root.