Operate on Ubuntu16.4.04, other versions are similar!
1. Set up root user login
1. First set the root user password: sudo passwd
You can use the su root command to switch to the root user and test whether the password is set successfully.
2. Switch to the root user and edit the file:
as follows:
3. Now you can use "login" after restarting, enter the root user name and password to log in, and remove the guest user login.
4. Switch to the root user and edit the file to solve the problem of the root user login error prompt:
change into:
Second, the installation and configuration of Vim
1. Vim installation:
Enter the installation command as an ordinary user: sudo apt-get install vim-gtk
Enter "y" and wait for the installation to complete.
vim --version command to view version information:
2. Vim configuration:
Configuration file: /etc/vim/vimrc
Open the configuration file and add related configurations.
set nu "Show line number
syntax on "Syntax highlighting
set cursorline "Highlight the current line
set ruler "Show ruler
set tabstop=4 "tab key indent
set expandtab
set shiftwidth=4 "Space instead of tab
set smartindent shiftwidth=4 "C language automatically indents 4 characters width
set ignorecase "search ignore case
set hlsearch "search character-by-character highlight
set incsearch
set showmatch "set the matching mode, input brackets will appear Close parenthesis
set showcmd "The entered command is displayed and you can see it clearly
set scrolloff=3 "Keep a distance of 3 lines when the cursor moves to the top and bottom of the buffer
set nocompatible "Remove the annoying vi-consistency mode and avoid some of the previous versions bugs and limitations
set completeopt=preview,menu "Code completion
as follows:
3. Access the server via SSH
1. First install ssh-server on the server: sudo apt-get install openssh-server2. Start the ssh service: sudo service ssh start
Check whether the ssh service is started: sudo ps -e |grep ssh
3. Modify the configuration file "/etc Add a sentence "PermitRootLogin yes" to the /ssh/sshd_config"
configuration file --> save the changes (allow root users to log in).
4. Remotely access the server through ssh: ssh user@ip
Example: ssh [email protected]
5. Download the file from the server
scp username@servername:/path/filename /var/www/local_dir (local directory)
Example: scp root @192.168.0.101:/var/www/test.txt
Download the file of /var/www/test.txt on 192.168.0.101 to /var/www/local_dir (local directory)
6. Upload the local file to the server
scp / path/filename username@servername:/path
Example: scp /var/www/test.c [email protected]:/var/www/
Upload the test.c file in the /var/www/ directory of the local machine to the /var/www/ directory on the 192.168.0.101 server
7. Download the entire directory from the server
scp -r username@servername:/var/www/remote_dir/ /var/www/local_dir
Example: scp -r [email protected]:/var/www/test /var/www/
8. Upload the directory to the server
scp -r local_dir username@servername:remote_dir
Example: scp -r test root @192.168.0.101:/var/www/
Upload the test directory in the current directory to the /var/www/ directory of the server