syntax of scp command

Asked by aneesh on 2010-01-07

Please give me the syntax of " scp " command for copying a file which is located in the /home/user/Desktop of remote pc to my localhost home folder.

                                                                                                        with Regards
                                                                                                       Aneesh T V

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu openssh Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
2010-01-08
Last query:
2010-01-08
Last reply:
2010-01-07

For almost all commands you can have the syntax by using the man command.
So please open a terminal and type:

man scp

Hth

Example:

scp remoteuser@remotepc:/home/user/Desktop/file_to_copy /your/path/.

Hth

You can also mount a remote pc filesystem using ssh by configuring the connection,
using the menu Places→Connect to server [ssh]

Then you can access to remote pc using Nautilus file manger

Hth

Might be useful to know the ip address of remote pc discover it type on remote from terminal ifconfig

Example on a local area network:

ifconfig on remote pc get:

eth0 Link encap:Ethernet HWaddr 00:50:fc:74:af:2d
          indirizzo inet:192.168.1.98 Bcast:192.168.1.255 Maschera:255.255.255.0
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:66702 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32111 errors:0 dropped:0 overruns:0 carrier:0
          collisioni:0 txqueuelen:1000
          Byte RX:56575971 (56.5 MB) Byte TX:3967227 (3.9 MB)
          Interrupt:18 Indirizzo base:0xec00

so the remote pc ip is 192.168.1.98

to connect remote pc (the remote pc must have the openssh-server package installed ) to install on remote pc type:

sudo apt-get install openssh-server

and started, to start type on remote pc:

sudo /etc/init.d/ssh start

Then from your local pc you can type:

scp remoteuser@192.168.198:/home/remoteuser/Desktop/file_you_want_to_copy $HOME/.

Hth

Then you can local mount a remote filesystem via ssh installing (locally) and using the sshfs package

Description: filesystem client based on SSH File Transfer Protocol
 sshfs is a filesystem client based on the SSH File Transfer Protocol. Since
 most SSH servers already support this protocol it is very easy to set up: i.e.
 on the server side there's nothing to do. On the client side mounting the
 filesystem is as easy as logging into the server with ssh.

 sshfs is FUSE (Filesystem in USErspace).
Homepage: http://fuse.sourceforge.net/sshfs.html

Tags: admin::filesystem, interface::shell, network::client, protocol::ssh,
      role::program, security::cryptography

to mount a remote filesystem using sshfs the syntax is sshfs [user@]host:[dir] mountpoint [options]

So you can mount the remote filesystem by typing:

mkdir $HOME/remotessh
sshfs rometeuser@remotehost: $HOME/remotessh

give the remote user password

Then you can the mountpoint listed into your local mounted filesystem mountpoints, type:

mount

And to access it from terminal type:

cd $HOME/remotessh

then to umount it type:

cd
sudo umount $HOME/remotessh

Hth

aneesh (aneesholv) said : #6

Thanks marcobra (Marco Braida), that solved my question.