Earlier I was working on a clients Mac OSX laptop and needed to login remotely without the hassle of setting a password and then removing it when I was done. The article below will describe not only how to enable SSH from a terminal window on the Macintosh laptop itself but also how to configure SSH so it will allow remote login via SSH without a password.
Configure SSH To Allow Logins Without A Password:
First you will need to modify the sshd_config file which can be found in the /private/etc/ directory. The sshd_config file has a bunch of options commented out which typically means the setting to the right of that option are the default options for sshd. The option we need to modify is PermitEmptyPasswords which is located around line 57 of the sshd_config file. Make sure when you are done you set this option back to the default setting and restart SSH. We will be changing the no to a yes on line 57 as shown below.
SSHD Default PermitEmptyPasswords Configuration Setting:
- # To disable tunneled clear text passwords, change to no here!
- #PasswordAuthentication yes
- #PermitEmptyPasswords no
Uncomment line 57 by removing the ‘#’ in front of PermitEmptyPasswords and change the no to a yes using your favorite text editor such as vi.
SSHD Default PermitEmptyPasswords Configuration Setting:
- # To disable tunneled clear text passwords, change to no here!
- #PasswordAuthentication yes
- PermitEmptyPasswords yes
Once you have made the modification to allow usernames without passwords to login via SSH you can start SSH using the information below.
Start SSHD Using Mac OSX Command Line From A Terminal Window:
Starting and stopping SSHD via the OSX CLI is easy. To start SSH simply type “/sbin/service ssh start” and to stop SSH you can type “/sbin/service ssh stop”. Both of these commands are shown in the below terminal capture.
- Macintosh-3:/ root# /sbin/service ssh start
- Macintosh-3:/ root#
- Macintosh-3:/ root# /sbin/service ssh stop
- Macintosh-3:/ root#
As you can see issuing each of he above commands will provide no output to the shell. After issuing the ssh start command above you should now be able to login to the OSX device on port 22 using a valid username without a password.
**Note** Please remember to set he PermitEmptyPasswords back to “no” after you are completed and shut down SSH since most desktops and/or laptops should not have this configured by default.
You should not under any circumstance do this. Bot will scan for your SSH server and will try logging in without a password.