Vous êtes sur la page 1sur 2

1.

Automatizar inicio de sesin mediante SSH

Don't use a password. Generate a passphraseless SSH key and push it to your VM.
If you already have an SSH key, you can skip this step Just hit Enter for the key and both passphrases:

$ ssh-keygen -t rsa -b 2048


Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.

Copy your keys to the target server:

$ ssh-copy-id id@server
id@server's password:

Now try logging into the machine, with ssh 'id@server', and check in to make sure we havent added extra keys that
you werent expecting.

.ssh/authorized_keys

Finally check logging in

$ ssh id@server

id@server:~$

You may also want to look into using ssh-agent if you want to try keeping your keys protected with a passphrase.

2. Habilitar usuario root to login.

Warning
While it's possible to do, it is not recommended.
Enabling
To actually enable root logins first you have to set a password for the root account and then unlock the locked root account. If you
don't set a password for the root account the passwd command will return
passwd: unlocking the password would result in a passwordless account.
So, first execute in a terminal
sudo passwd root
you will be prompted for a new Unix password. Write it twice (second for confirmation).
Then execute
sudo passwd -u root
to unlock the account. This should return
passwd: password expiry information changed
Reverting back
If you want to disable root account in Ubuntu you need to lock the root account by using the following command
sudo passwd -l root
Sobre SSH
You need to edit /etc/ssh/sshd_config, and comment out the following line:
PermitRootLogin without-password
Just below it, add the following line:
PermitRootLogin yes
Then restart SSH:
service ssh restart

Vous aimerez peut-être aussi