Transferring files over SSH [closed]. Nautilus supports SCP via the Connect To Server option. Scp can only copy files to a machine running sshd, hence you need to run the client software on the remote machine from the one you are running scp on. If copying on the command line, use.
I'm SSHing into a remote server on the command line, and trying to copy a directory onto my local machine with the scp
command. However, the remote server returns this 'usage' message:
I'd like to be able to transfer files in both directions. From what I read, I thought the above command would work for downloading, and scp -p [localpath] [remotepath]
for uploading?
Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.
You need to scp
something somewhere. You have scp ./styles/
, so you're saying secure copy ./styles/
, but not where to copy it to.
Generally, if you want to download, it will go:
where local_file
might actually be a directory to put the file you're copying in. To upload, it's the opposite:
If you want to copy a whole directory, you will need -r
. Think of scp
as like cp
, except you can specify a file with user@remote_host:file
as well as just local files.
Edit: As noted in a comment, if the usernames on the local and remote hosts are the same, then the user can be omitted when specifying a remote file.
Davide SpataroIf copying to/from your desktop machine, use WinSCP, or if on Linux, Nautilus supports SCP via the Connect To Server option.
scp can only copy files to a machine running sshd, hence you need to run the client software on the remote machine from the one you are running scp on.
If copying on the command line, use:
or
JeeBeeJeeBeeYou need to specify both source and destination, and if you want to copy directories you should look at the -r option.
So to recursively copy /home/user/whatever from remote server to your current directory:
KenKenNo, you still need to scp [from] [to]
whichever way you're copying
The difference is, you need to scp -p server:serverpath localpath
Ubuntu includes a variety of utilities for connecting to secure shell servers. The standard “ssh” command connects to the remote SSH server and provides a terminal prompt that you can use to run commands on, but you can also use the secure copy, or 'scp,' command, which connects to a remote SSH server and transfers files between your local computer and the remote computer. The SSH protocol provides encryption, so no one can eavesdrop on files copied using the 'scp' command.
Open a terminal by clicking the “Terminal” shortcut in your applications menu.
2.Type the following command into the terminal, replacing “/path/to/file” with the location of the file you want to upload, “username” with your username on the remote system, “example.com” with the domain name or IP address of the remote system and “/path/for/file” with the location you want to place the file on the remote system:
scp /path/to/file username@example.com:/path/for/file
3.Press “Enter.” An authentication prompt appears.
4.Type the remote user account’s password at the password prompt and press “Enter.” Depending on the authentication method configured on the remote SSH server, you may have to authenticate with a key or another method instead.
Chris Hoffman is a technology writer and all-around tech geek who writes for PC World, MakeUseOf, and How-To Geek. He's been using Windows since Windows 3.1 was released in 1992.