Setting a password rather than using your key

If you’re like me, you get frustrated when you have to keep this key lying around all the time. We can actually set your system up to use a regular ol’ password in addition to the key (so that you can use either/or). But for that you need to edit files, so go read up on editing files (see Using the Nano editor).

The file you need to edit is the SSH configuration file, located here:


To edit it, type:

%% nano /etc/ssh/sshd_config

(Briefly, the ‘etc’ directory contains a bunch of system config files; the ‘ssh’ subdirectory contains the SSH config files; and the name of the config file is ‘sshd_config’.)

Now, scroll down (with the down arrow key) and find the line ‘Password Authentication’. Change that to ‘yes’ from ‘no’ by using the delete or backspace key.

(Remember: if you screw up, just exit, don’t save, and re-edit!)

The line should look like this:

PasswordAuthentication yes

Now, exit, and save.

Next, you need to actually set the password. To do that, type:

%% passwd

and type a super-secret password (you won’t see it ‘echoed’ to the screen, duh). Hit Enter. Type it again.

OK, now you’re done! All you need to do is restart SSH. There are two ways to do that, the easy way and the hard way. The easy way is to reboot the machine; type

%% shutdown -r now

and wait for a minute while the machine reboots. Now you can log into it again, but using the password instead of the key!

The slightly harder way is to find the SSH process and send it a ‘signal’ to tell it to restart itself. Briefly,

%% ps auxw | grep sshd

You’ll get output that looks like this

root       736  0.0  0.0   5432  1020 ?        Ss   11:42   0:00 /usr/sbin/sshd
root       802  0.0  0.1   8152  2640 ?        Ss   11:43   0:00 sshd: root@pts/0
root       816  0.0  0.0   1848   592 pts/0    R+   12:07   0:00 grep sshd

Take the first number on the first line (736, in this case) and do

%% kill -HUP 736

and that will tell SSH to re-read its config file. (I told you it was more complicated.)

LICENSE: This documentation and all textual/graphic site content is licensed under the Creative Commons - 0 License (CC0) -- fork @ github. Presentations (PPT/PDF) and PDFs are the property of their respective owners and are under the terms indicated within the presentation.
comments powered by Disqus