Badb0y
Badb0y

Reputation: 351

sudo su - immediately after SSH

I have this SSH config file for root:

User    ansible
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
PermitLocalCommand yes
LocalCommand='/bin/sudo /bin/su -'
IdentityFile    /root/.ssh/ansible_onlinux

(FYI I've tried with ' " without anything, same issue) When I ssh to the server I got this error.

/bin/bash: /bin/sudo: No such file or directory

However if I run the command on the machine it works. Where is the problem?

I want to ssh from my ubuntu on windows (WSL) to a centos server.

Upvotes: 2

Views: 6564

Answers (1)

Badb0y
Badb0y

Reputation: 351

This is the working config.

User    ansible
IdentityFile    /root/.ssh/ansible_onlinux
UserKnownHostsFile=/dev/null
StrictHostKeyChecking no
LogLevel=error
RequestTTY force
RemoteCommand sudo su -

Upvotes: 6

Related Questions