Skip to content

Commit e72d14b

Browse files
author
Benjamin
committed
Added commands file for creating a new user in ubuntu 16.04
1 parent 56c3728 commit e72d14b

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
File renamed without changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Install PostreSQL on Ubuntu 16.04
2+
3+
While logged in as root user:
4+
5+
```bash
6+
apt-get update
7+
apt-get install postgresql postgresql-contrib
8+
```
9+
10+
After installation, change user to postgres user by running
11+
```bash
12+
sudo -i -u postgres
13+
```
14+
15+
Connect to the database by running
16+
17+
```bash
18+
psql
19+
```
20+
21+
To exit postgres database console, run
22+
23+
```bash
24+
\q
25+
```
26+
27+
To exit postgres user
28+
```bash
29+
exit
30+
```
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Create a user in Ubuntu 16.04
2+
To create a new user, run the following command and enter the user details as prompted (password, full name etc). Remember to replace "jose" with the name of your user.
3+
4+
5+
```bash
6+
adduser jose
7+
```
8+
9+
# Add the new user to sudo users
10+
11+
Running the visudo command will open a file (normally located at /etc/sudoers).
12+
```bash
13+
visudo
14+
```
15+
16+
Under "User privilege specification", add the following line below root line
17+
18+
```bash
19+
jose ALL=(ALL:ALL) ALL
20+
```
21+
22+
Save the file with CNTR+O and press enter to save it. Then CNTR+X to exit the file.
23+
24+
# To enable logging in to the server as the newly created user, enable password login to the server by running
25+
26+
```bash
27+
vi /etc/ssh/sshd_config
28+
```
29+
30+
This opens another file. To disable root login with password, change the following line. Note you need to press "i" key to go to insert/edit mode before changing the contents of the file.
31+
32+
```bash
33+
PermitRootLogin yes
34+
```
35+
36+
to
37+
38+
```bash
39+
PermitRootLogin no
40+
```
41+
42+
Scroll down to the end of the file and add the following line
43+
44+
```bash
45+
AllowUsers jose
46+
```
47+
48+
49+
To exit edit/insert mode, press escape key then ":" followed by wq and press enter. "wq" writes the file to disc and quits the file.
50+
51+
Finally, run
52+
53+
```bash
54+
service sshd reload
55+
```
56+
57+

0 commit comments

Comments
 (0)