Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

Some useful linux commands

 

SSH Login Without Password

# STEP 1
# Creation of the key
# ================
# key will be stored on local host:  ~/.ssh/known_hosts
# Confirm with Enter for all requests
ssh-keygen

# STEP 2
# Copy the key to the remote host
# =======================
# key will be stored on remote host my-remote-host: ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub my-remote-host

# STEP 3
# Check if you can login without password
ssh my-remote-host

# USEFUL COMMAND 
# Remove Offending Key
ssh-keygen -R my-remote-host

 

 more details on the geek stuff

 

SSHFS - Mount a remote folder

# mount the remote folder home to local /mnt/mylocalfolder_
# no password if you have done "SSH Login Without Password"
sshfs root@host7.myremotehost.com:/home /mnt/mylocalfolder

Copy from local host to remote using scp

#note: you have to run this command from the linux host source where there is the folder
scp -r /sourcefolder root@myhost.com:/targetfolder/

 Ubuntu Help scp

 

Copy from local host to remote using rsync

Here what do the script

  • sync local folder to remote
  • exclude from sync all files list in the text file rsync_exclusion-file.txt
  • show time to start/end
  • use year and month as target folder. ie sav_all_2016-03
# rsync
yymm=`date +%Y-%m` mytime=`date +%Y-%m-%d_%H:%M:%S` echo $0 - START at : $mytime rsync -a --exclude-from=/root/mybatch/rsync_exclusion-file.txt /home/backup/sav_all root@host7.tedica.it:/home/backup/host7.byman.it/sav_all_$yymm mytime=`date +%Y-%m-%d_%H:%M:%S` echo $0 - END at : $mytime

 tutorial on digital ocean

 

 

...to be continue...

 

DISQUS - Leave your comments here