ssh login as user and change to root, without sudo
1
1
I have the following task: the command has to be run as root on server remotely in bash script over ssh and the command output has to be fetched in variable. logging over ssh as root is disabled. sudo on server is disabled, so I have to use su. EDIT: since I want to make it as automated as possible in bash, the password has to be stored inside command I have Googled for days, but it seems that I cannot find a solution for this. Solution proposed here: ssh to server and switch user and change a directory ssh -t username@hostname "sudo su - otheruser -c "cd /path/to/directory && command"" does not work because sudo is disabled on server: Does anyone have a solution to this?
ssh su
...