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

# 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/ my-remote-host

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

# 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 /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

 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$yymm mytime=`date +%Y-%m-%d_%H:%M:%S` echo $0 - END at : $mytime

 tutorial on digital ocean be continue...


DISQUS - Leave your comments here