how to get started with an ubuntu server

1.set up wireless connection

on first boot, using "netplan" settings, refers to :https://netplan.io/examples/

(todo: what about cloud-init?)

2.get ssh connection

sudo apt install SSH daemon

sudo ufw allow 22

ssh-copy-id -i ~/.ssh/id_rsa.pub YOUR_USER_NAME@IP_ADDRESS_OF_THE_SERVER

3.ssh alias setting
vim ~/.ssh/config

Add all of your remote hosts details like below:

Host webserver
HostName 192.168.225.22
User sk

4.change server name
hostnamectl set-hostname <new_hostname>

5.change server username
Reboot your computer and login as root

Open a terminal and Use blow command to change your username

usermod -l newname oldname

(Optional)Now you already changed your username,but your home folder name still are “/home/oldname”,if you also want to change /home/oldname to /home/newname just run below command
usermod -m -d /home/newname newname
Note:Of course you can combine step 2 and step 3 using below command

usermod -m -d /home/newname -l newname oldname

5.copy files with ssh

Syntax:

scp <source> <destination>
To copy a file from B to A while logged into B:

scp /path/to/file username@a:/path/to/destination
To copy a file from B to A while logged into A:

scp username@b:/path/to/file /path/to/destination

7.display gui while using ssh

Displaying remote X clients with Cygwin/X using ssh
if windows, frist install Cygwin/X

ssh -Y username@remote_hostname_or_ip_address

8.manage wireless connection

using "nmcli" to manage wireless connections

上一篇:tomcat


下一篇:[AWS] Talk: Getting started with AWS identity