Skip to main content

OpenSSH Public Key Authorization on Linux

To find out whether a user exists or not in a Linux machine:
*    grep username /etc/passwd
*    id username

To give a new user access to Linux machine:
1. Login as root user
2. Run this:
    $ /usr/sbin/adduser new_user
3. Set a new password:
    $ passwd new_user
    (and put the password when prompted)

To give them root access:
4. Edit the /etc/sudoers file
    $ vi /etc/sudoers
    User_Alias YOUR_GROUP = new_user

To test whether the new_user has been granted root access, run these two commands:
    $ su new_user (user should be 'new_user' now)
    $ sudo su (user should be 'root' now)
If the conditions above met, then new_user has root access.

If the new_user want to use public/private key gen authorization:
5. Change your user to be the new_user
    $ su new_user
6. Create ~/.ssh/authorized_keys file if it doesn't exist yet
    $ mkdir ~/.ssh
    $ chmod 700 ~/.ssh
7. Insert the public key on the authorized_keys file
    $ vi ~/.ssh/authorized_keys
    (insert the public key entry)


Popular posts from this blog

On Lying..

Lifehacker shows up with an article titled " How to Be an Effective Liar ". One comment cracks me up.. When I was a kid, I learned pretty quickly that the best way to lie is to tell the truth, but embellish it so much that it won't be believed.   "Did you have a party while your mother and I were gone?"   "Oh yeah! You missed out. It started out fairly small, but by the end, E! News showed up and the Goodyear blimp did a couple of flyovers. Luckily, Martha Stewart got the ankle tracker off, so she came out and helped us clean up afterwards. I'll make sure we take pictures next time." Hahaha.. ^_^

On Typing...

Does people realize that: 1. misspelling a word makes them look uneducated, and 2. using shorthand in emails makes them look 5 ?? Emails are NOT telegrams! You cannot save money by typing less characters in your emails, people! (I can understand if it's in SMS). Ugh! (Just have to vent...) >_<


I know intellectually that worry solves nothing. But I am worried. About the things that are out of my hands. And I am sad, because it involves people, and I can't do anything about it. I am starting to believe that helplessness is the root of all worries. Hhhh...