After purchasing a server from Bytehouse cloud products, refer the below steps to create a new user to manage your server
Create a user
It is always recommended to login as non-root user and perform administration activities. To create a user, execute the following commands in your server.
root@yourserver-$ adduser bob
bob can be replaced by a username of your choice
Now we need to create a password for this newly created user.
passwd bob
please ensure to generate and use strong passwords
We have created user bob and created a password for the user. If you navigate to /home
you will be able to see the home directory of user bob.
root@yourserver-$ cd /home/
root@yourserver-$ ls
bob
However for performing certain administration tasks in the server, user bob requires higher privileges. You can use /usr/sbin/visudo
to grant root privileges to the user.
Execute the below command.
/usr/sbin/visudo
Locate the following line
root ALL=(ALL) ALL
Add the line bob ALL=(ALL) ALL
next to the above line.
## Syntax:
##
## user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
bob ALL=(ALL) ALL
Logout from the server using the command logout
.
Login as user bob
$ ssh bob@your-server-ip
bob@188.191.157.163's password:
bob@your-server$
Verify that user bob have root privileges, execute the command sudo su
to switch to root. Enter password of user bob when prompted.
bob@yourserver$ sudo su
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for bob:
root@yourserver-$
We have created a new user in the server and succesffuly connected to the server using SSH protocol using the username/password combination.
Alternatively, you can use key based authentication to connect to the server.