# linux setup

#### Create a New Sudo User

To add a new sudo user, open the terminal window and enter the command:

```
adduser UserName
```

Use the actual username for your new user in place of ***UserName***.

Next, create a password for the new user by entering the following in your terminal window:

```
passwd UserName
```

The system should display a prompt in which you can set and confirm a password for your new user account. If successful, the system should respond with “all authentication tokens updated successfully.”

#### Add User to Group

To add a user to the wheel group, use the command:

```
sudo usermod –aG wheel UserName
```

As usual, replace ***UserName*** with the name of the user receiving sudo privileges.

#### Step: 3 Switch to the Sudo User

Switch to the new (or newly-elevated) user account with the **`su`** (substitute user) command:

```
su - UserName
```

Enter the password if prompted. The terminal prompt should change to include the UserName.

[![](https://4.bp.blogspot.com/-bX96JxD5lSI/W3ZlwiW0GUI/AAAAAAAAIiY/Zy2sIFG8NIYO4KNjbngo9K8FV-IVSHlJQCLcBGAs/s1600/ec2-ssh-password.jpg)](https://4.bp.blogspot.com/-bX96JxD5lSI/W3ZlwiW0GUI/AAAAAAAAIiY/Zy2sIFG8NIYO4KNjbngo9K8FV-IVSHlJQCLcBGAs/s1600/ec2-ssh-password.jpg)\
By default, AWS ec2 instances don’t have password authentication. You have to use the private key to connect to the instances. However, you might have situations to use password-based authentication for your AWS ec2 instances.\
\
In this tutorial, we have done the configuration to enable password authentication in AWS instance.\
\
**Step 1:**\
\
Login to AWS instances<br>

| ssh -i your-key.pem username\@ip\_address |
| ----------------------------------------- |

\
**Step 2:**\
\
Setup a password for the user using **passwd** command along with the **username**.<br>

| sudo passwd ubuntu |
| ------------------ |

\
**Step 3:**\
\
Edit **sshd\_config** file.<br>

| sudo vim /etc/ssh/sshd\_config |
| ------------------------------ |

\
Find the Line containing **'PasswordAuthentication'** parameter and change its value from **'no'** to **'yes'**<br>

| PasswordAuthentication yes |
| -------------------------- |

\
If you want to set up **'root'** login, find  **'PermitRootLogin'** parameter and change its value from **'prohibit-password'** to **'yes'**<br>

| PermitRootLogin yes |
| ------------------- |

\
After this changes **save file** and exit.\
\
**Step 4:**\
\
Restart the SSH service.\ <br>

| <p>service ssh restart                                  ## for ubuntu<br>service sshd restart                                ## for centos</p> |
| ---------------------------------------------------------------------------------------------------------------------------------------------- |

\
**Step 5:**\
\
Now we can log in using the password you set for the user. For example,<br>

| ssh ubuntu\@54.224.72.66 |
| ------------------------ |
