When you are in NoVnc or which ever console you choose to use, start with updating your Centos by typing:
yum update
(press y + enter to the question that appear)
After the update, type:
yum install openssh-server
You can check the status of the sshd server when the install is finished by typing:
systemctl status sshd
Next step is to edit the file sshd_config.
We are doing that with the built in text editor in Centos that is called VIM. When editing the text file we use the command "vi".
To edit with Vi, the editor has two modes: Command and Insert.
When you first open a file with Vi, you are in Command mode. Command mode means you can use keyboard-keys to navigate, delete, copy, paste, and do a number of other tasks, except entering text.
To enter text you need to press i (now you are in Insert mode). In Insert mode, you can enter text, use the Enter key to go to a new line, use the arrow keys to navigate text, and use vi as a free-form text editor. To return to Command mode, press the ESC-key once.
Start by typing:
vi /etc/ssh/sshd_config
Finde the line #PermitRootLogin prohibit-password
Remove the # and change prohibit-password to yes on this line: "#PermitRootLogin prohibit-password"
It should look similar like this when fished editing:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
After you have edit the line it's time to save it, press the ESC-key (to get back into Command mode). And then type this sequence :wq
Your sshd_config file is now saved, and the last thing that we need to do is to restart the sshd server by typing:
systemctl restart sshd
That's it, you should now be able to login with SSH through command line.
Vi shortcuts
This is a breif list of shortcuts, they will enable you to edit files and learn Vi in a short amount of time.
$ vi <filename>
— Open or edit a file.i
— Switch to Insert mode.- Esc — Switch to Command mode.
:w
— Save and continue editing.:wq
orZZ
— Save and quit/exit vi.:q!
— Quit vi and do not save changes.yy
— Yank (copy) a line of text.p
— Paste a line of yanked text below the current line.o
— Open a new line under the current line.O
— Open a new line above the current line.A
— Append to the end of the line.a
— Append after the cursor’s current position.I
— Insert text at the beginning of the current line.b
— Go to the beginning of the word.e
— Go to the end of the word.x
— Delete a single character.dd
— Delete an entire line.Xdd
— Delete X number of lines.Xyy
— Yank X number of lines.G
— Go to the last line in a file.XG
— Go to line X in a file.gg
— Go to the first line in a file.:num
— Display the current line’s line number.h
— Move left one character.j
— Move down one line.k
— Move up one line.l
— Move right one character.