Eikonal Blog

2010.12.16

SSH, OpenSSH

SSHFS (SSH FileSystem)

Related:

Authentication via public keys

SFTP

FTPS vs SFTP

Using SCP

  • Example syntax for Secure Copy (scp) – http://www.hypexr.org/linux_scp_help.php
    • Copy the file “foobar.txt” from a remote host to the local host: $ scp your_username@remotehost.edu:foobar.txt /some/local/directory
    • Copy the file “foobar.txt” from the local host to a remote host: $ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
    • Copy the directory “foo” from the local host to a remote host’s directory “bar”: $ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
    • Copy the file “foobar.txt” from remote host “rh1.edu” to remote host “rh2.edu”: $ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \
      your_username@rh2.edu:/some/remote/directory/
    • Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host: $ scp foo.txt bar.txt your_username@remotehost.edu:~
    • Copy multiple files from the remote host to your current directory on the local host: $ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\}. Also:: $ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .

Use of Expect with SSH suite applications

Password-less SFTP

Establish the SFTP connection to the system AAAA where the user account BBBB has password CCCC, and go to the directory DDDD, all without being prompted to enter the password:

    sftpToAAAA.expect
    #!/bin/expect
    # sftpToAAAA.expect
    
    spawn sftp BBBB@AAAA
    expect "password" {
       sleep 1
       send "CCCC\n"
    }
    send "cd DDDD\n"
    interact
    

All normal warning on the danger of hard-wiring the password into scripts are in place here.

Password-less SCP

Use the SCP to upload connect system AAAA with user account BBBB (that has password CCCC), and upload the file EEEE to the directory DDDD, all without being prompted to enter the password:

    UploadEEEEtoAAAA.expect
    #!/bin/expect
    spawn scp EEEE BBBB@AAAA:DDDD/EEEE
    expect "password" {
      send "CCCC\n"
    }
    

More

4 Comments »

  1. […] SSH, OpenSSH – https://eikonal.wordpress.com/2010/12/16/ssh-openssh/ […]

    Like

    Pingback by Unix hardening « Eikonal Blog — 2010.12.16 @ 15:58

  2. A domain name has changed for Lapipaplena. Please update your link for:
    http://wiki.gilug.org/index.php/How_to_mount_SFTP_accesses

    Like

    Comment by l — 2012.10.30 @ 03:02


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: