Default username for CentOS instance (on AWS) is: centos
Note: In CentOS use,
- sudo su in changing to a root user or
- Sudo su <username>
After creating an instance start the PuttyKeyGen
Click on Load
By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.
Now you should be able to view the keyfile download from the instance containing the public.
Choose Save private key to save the key in the format that PuTTY can use. PuTTYgen displays a warning about saving the key without a passphrase. Choose Yes.
Enter the connection name or IP and select port 22
To have the private key entered,
Expand Connection, expand SSH, and then choose Auth and choose Browse.
Now click on Open, you should be able to access the server. The default username for CentOS is centos
To create a password for this user, edit the sshd_config setting and save it
change the PasswordAuthentication value as yes
:wq (means save and exit)
Restart the SSH service
service sshd restart
To add a user account in order to connect to the EC2 instance via a username and password on CentOS
Step A: To add a user to the system, issue the useradd command to create a locked user account:
Step B: Unlock the account by issuing the passwd command to assign a password and set password aging guidelines:
This must be the same user name in step A above. After this criteria has been met, then you should be able to set the password
Now: Connect a new session and test with the user account created.
Adding a user as a Sudoer on CentOS: Because certain action can only be performed by Linux Administrators on Linux, this makes the root by default have access to whatsoever on the Linux Machine. Since we have the root user account disabled, we will create a new user account and add the user to the Sudoer file thereby granting him all privileges he needs.
– Steps 1: First Create a user account and the steps can be found in this document above
– Step 2: The file in Linux that determines if you are eligible to execute the Sudo is called “Sudoers” and this can be found in this location /etc/sudoers
But it is not recommended to modify this file as it is detrimental! Why is it so? This is because any syntax error found in this file could affect the entire system. So there is a unique used called visudo
[firstname.lastname@example.org]# visudo After running this comment, use “i” to insert and search for the file (this will prompt the sudoer file for editing (modification) ## Allow root to run any commands anywhere Below this you will see lines like (Add the username and permission as the root user) as shown in the screenshot below, e.g, [username] ALL=(ALL) ALL
This is all.
Question? What is visudo?
The sudo command is configured through a file located at /etc/sudoers