Phat Site Blog

Tag: ssh

Setting up SSH for New Users

by admin on Feb.06, 2009, under Server Maintenance

Make sure you are root, let’s get cracking!

/usr/sbin/useradd username – create the user
su username
passwd username – set the password

When you log into your new created user, you will create hidden directory called “.ssh”.  In this directory, you will also create a  file called “authorized_keys”.

mkdir .ssh
cd .ssh
touch authorized_keys

You will need to generate a key from your local machine to use to authenticate when you login.  On your local machine, let’s get generating! Use command “ssh-keygen -t rsa”.  You will be prompted for a password.  This is optional.  Once completed, a public and private key will be saved in the “~/.ssh” folder.

On your remote server, you need to copy the public key information.

scp ~/.ssh/id_rsa.pub myremoteuser@11.22.33.44:~/
cat id_rsa.pub >> ~/.ssh/authorized_keys
rm id_rsa.pub
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Once, you add this in, make sure the user is setup in the ‘AllowUsers’ of SS for SSH Access.  This is set in the /etc/ssh/sshd_config file.  Since you are using SSH keys, you don’t need a password anymore, so set “PasswordAuthentication yes” to “PasswordAuthentication no”.

/usr/sbin/visudo – If you want to give some sudo permissions for this user.

Leave a Comment : more...

Creating a New User in CentOS 5

by admin on Jan.25, 2009, under Server Maintenance

Creating a New User in CentOS 5

1. SSH to your server as root
2. Create a user:  /usr/sbin/useradd newuser
3. Expire ther user immediately: /usr/bin/chage -d 0 newuser
4. Set blank password: /usr/sbin/usermod -p “” newuser
5. If you want to set the user’s password:
* su newuser
* passwd
Changing password for user newuser
New UNIX password: <enter your password>
Retype new UNIX password: <enter your password>
passwd: all authentication tokens updated successfully.

That’s it!  From there on, you have a user that can be used to host your website or blog!

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!