SSH on Linux Using Ubuntu

Asked

Viewed 98 times

0

Which command I use for SSH authentication Also by user and password to access the server without having to do this encrypted password ""

I set up a server on Amazon and for me to access I need the key authenticated until then I enter peacefully being that I created another user and I want to give access to it without the need of key so with login and password that I created it ( I was informed that I need to enable inside the ssh server authentication for user and password )I was told that and only one line eating more I am not finding anywhere ""

2 answers

1

I usually copy the public RSA key from my local computer to the authorized keys from my remote server, so just type ssh user@ip to connect directly.

To do this run the command below:

cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

Substitute user@ip at the right values.

Now run the command below to login:

ssh user@ip

Just like that :D.

  • A detail, if on both computers the username is the same, for example bruno, it is not necessary to inform the user, ex.: ssh ip or ssh domain.com.

  • Thank you Fight all right

  • Did my answer help you? If so, mark it as the right answer.

0


First of all, I would suggest that you not use user authentication/password for security reasons. Key authentication should be the preferred method.

Now, to answer your question, you can use a block Match and the directive PasswordAuthentication in the file sshd_config (usually in /etc/ssh/sshd_config) to select users for whom you wish to allow authentication by username/password. To do this, add end of file the following:

PasswordAuthentication no

Match User fbasilio
    PasswordAuthentication yes

This will disable username/password authentication for all users except fbasilio.

Then you just have to restart the service (for example, /etc/init.d/sshd reload or in Ubuntu service ssh restart)

The reason why you should add this at the end of the file is because if all the criteria in the Match block are checked, then this will affect all lines up to the next Match block or end of the file.

More information on http://linux.die.net/man/5/sshd_config

  • It worked Thank you Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.