ssh hostname "rm -f z100.foo z200.foo"
ssh [email protected] -p22 "rm -rf /home/amzad/test.php"
ssh server1 "cd dir1 && tar -cf - ." | ssh server2 "( mkdir -p dir2; cd dir2 && tar -xf - )"
scp -prq server1:dir1/* server2:dir2/
scp source_file_name username@destination_host:destination_folder
scp -v Label.pdf [email protected]:.
scp -p Label.pdf [email protected]:.
scp -Cpv messages.log [email protected]:.
scp -c 3des Label.pdf [email protected]:.
Specify specific port to use with SCP, Usually SCP is using port 22 as a default port. But for security reason, you may change the port into 2249.
scp -P 2249 Label.pdf [email protected]:.
scp -r documents [email protected]:.
Proxy server is usually used in office environment. Natively, SCP is not proxy configured. When your environment using proxy, you have to “tell” SCP to communicate with the proxy. Here’s the scenario. The proxy address is 10.0.96.6 and the proxy port is 8080. The proxy also implemented user authentication. First, you need to create “~/.ssh/config” file. Second you put this command inside it.
ProxyCommand /usr/bin/corkscrew 10.0.96.6 8080 %h %p
/.ssh/proxyauth Then you need to create file “/.ssh/proxyauth” which contain. lease notice that corkscrew is might not installed yet on your system. myusername:mypassword$ apt-get install corkscrew
For mobile user who often switch between company network and public network, it will be suffer to always change settings in SCP. It is better if we can put a different ssh_config file to match our needs. By default “ssh_config” file per user will be placed in “~/.ssh/config“. Creating a specific “ssh_config” file with proxy compatible, will make you easier to switch between networks. When you are on company network, you can use “-F” parameter. When you are on public network, you can skip “-F” parameter
scp -F /home/pungki/proxy_ssh_config Label.pdf
scp -rq katalog/* label:c:/jenkins/agent/