1. 程式人生 > >Ubuntu Server 16.04 LTS初始化

Ubuntu Server 16.04 LTS初始化

Ubuntu Server

1. adduser
root@ubuntu:~# adduser lwk
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "zh_CN.UTF-8",
    LC_ADDRESS = "zh_CN.UTF-8",
    LC_MONETARY = "zh_CN.UTF-8",
    LC_NUMERIC = "zh_CN.UTF-8",
    LC_TELEPHONE = "zh_CN.UTF-8",
    LC_IDENTIFICATION = "zh_CN.UTF-8",
    LC_MEASUREMENT = "zh_CN.UTF-8",
    LC_NAME = "zh_CN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Adding user `lwk‘ ...
Adding new group `lwk‘ (1001) ...
Adding new user `lwk‘ (1001) with group `lwk‘ ...
Creating home directory `/home/lwk‘ ...
Copying files from `/etc/skel‘ ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for lwk
Enter the new value, or press ENTER for the default
    Full Name []: lwk
    Room Number []: 
    Work Phone []: 
    Home Phone []: 
    Other []: 
Is the information correct? [Y/n] 
root@ubuntu:~# 

2.sudo權限

usermod -a -G sudo lwk

3.install openssh-server

root@ubuntu:~# apt install openssh-server

4.添加本地公鑰到遠程服務器上去

lwk@qwfys ~ $ ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

如果些前已經用當前密鑰登錄過遠程服務器,需要用下面命令從本地刪除老的遠程服務器列表

lwk@qwfys ~ $ ssh-keygen -f "/home/lwk/.ssh/known_hosts" -R 192.168.1.25

5. ssh登錄

lwk@qwfys ~ $ ssh [email protected]
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

75 packages can be updated.
32 updates are security updates.

Last login: Fri Nov 10 14:53:04 2017 from 192.168.1.4
lwk@ubuntu:~$ 

Ubuntu Server 16.04 LTS初始化