0

On my server, I've got openssh-server and a special account without password. I'm creating a shell script, that must be used without user input. For example

$(ssh dummyUser@dummy.com)

I need script to end after signing in. How to do it? (I know about authorised keys).

0

Account with no password is quite dangerous. Try to use key authorization like that:

$(ssh -u dummyUser -i keyfile dummy.com /path/to/the/some_script_on_the_dummy_com.sh)

And remember that for unattended login your keypair should not be protected by password.

0

Try this:

a@A:~> ssh-keygen -t rsa
a@A:~> ssh-copy-id b@B
a@A:~> ssh b@B

If ssh-copy-id is unavailable, use this:

a@A:~> ssh-keygen -t rsa
a@A:~> ssh b@B mkdir -p .ssh
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
a@A:~> ssh b@B

To end a session, use the exit command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.