Last active
July 28, 2016 10:19
-
-
Save royharoush/b9f9746625bbabe2436c12a2dec4569a to your computer and use it in GitHub Desktop.
SSHFS, SSH, and Private Keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##create public and private keys | |
# ssh-keygen | |
Generating public/private rsa key pair. | |
Enter file in which to save the key (/root/.ssh/id_rsa): | |
Enter passphrase (empty for no passphrase): | |
Enter same passphrase again: | |
Your identification has been saved in /root/.ssh/id_rsa. | |
Your public key has been saved in /root/.ssh/id_rsa.pub. | |
The key fingerprint is: | |
SHA256:/QXXXXXXXXXXXXXXXXXXXE root@somemachine | |
The key's randomart image is: | |
+---[RSA XXXXX]----+ | |
+----[SHAXXXX]-----+ | |
## copies your public key into the supplied server | |
#ssh-copy-id IP_address | |
[enter your SSH root password] | |
## adds your private key into your current terminal sessions (you'll need to provide the password) | |
#ssh-add | |
## install the sshfs client | |
# apt-get install sshfs | |
## bashrc function to map the remote server into the mnt folder, it will either prompt for the password, or use your private key | |
function sshfs-prepare(){ | |
cd /mnt | |
mkdir /mnt/$1 | |
sshfs root@$1:/ /mnt/$1 | |
cd /mnt/$1 | |
} | |
#ssh IP_address <--- should log you automatically | |
Remember to use CTRL+r to cycle through last commands for easier navigation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment