Menu

Share files between two Ubuntu computers

March 23, 2017 - Linux
sudo apt-get install openssh-server

Edit config

sudo nano /etc/ssh/sshd_config

Change

Port 2222  // change from default 22
PermitRootLogin no
RSAAuthentication no
PubkeyAuthentication no
AllowUsers maja

Also test

$ ssh -o PubkeyAuthentication=no root@host  // if there are too many keys in keyring

Add to hosts

sudo nano /etc/hosts
127.0.0.1       localhost
192.168.0.107   rubikon-acer
192.168.0.105   cinema

Folder options

Enable sharing of the folder. If Samba is not installed, it will ask you to install it.
Set properties of the folder.

Set samba password

 sudo smbpasswd -a <user name // it will ask you for password
sudo restart smbd or sudo service samba-ad-dc restart

Get hostname:

hostname
cat /etc/hostname 
cat /etc/hosts

Change hostname

hostnamectl set-hostname 'new-hostname'

or

sudo nano /etc/hostname
sudo nano /etc/hosts
sudo service hostname restart

Check username

whoami

Check local IP address

hostname -I

Scan local network

sudo apt-get install arp-scan
sudo arp-scan 192.168.0.0/24

or

sudo apt-get install netdiscover
sudo netdiscover -r 192.168.0.0/24

Connect to the server via ssh

ssh -l maja -p 2222 192.168.0.105

Connect to the server via sftp

sftp://laptop_user_id@laptop_name.local/home/laptop_user_id

sftp://maja@192.168.0.105:2222/home/maja/Desktop

Connect via smb

smb://server/folderName
smb://192.168.0.105/ongit