scping files while logged in via ssh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers scping files while logged in via ssh
# 1  
Old 07-09-2010
scping files while logged in via ssh

Hi, I was wondering how I would copy a file from a server to my computer while being logged into the server via ssh. I know I can get the file by using scp or sftp while logged out, but is there a way to do this while in an ssh connection?
# 2  
Old 07-09-2010
Lightbulb Using scp while logged in via ssh

You've apparently logged into the server with ssh and you have a terminal shell running. If your client is also running an ssh daemon (that means, you can log into it remotely), you can scp the file from the server.

For example, assume that the server's name is 'waco' and the client's name is 'laredo'. Here is an example to copy a file from waco to laredo -- the user's name has been changed to 'xxxxxx':
Code:

laredo:~ xxxxxx$ mkdir tmp
laredo:~ xxxxxx$ ssh waco
Linux waco 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

Last login: Fri Jul  9 19:38:58 2010 from laredo
xxxxxx@waco:~$ cd Documents/
xxxxxx@waco:~/Documents$ ls -l
total 155212
-rw-r--r-- 1 xxxxxx xxxxxx 130720176 2010-02-15 14:45 Blue_Angles_HD.mp4
xxxxxx@waco:~/Documents$ scp Blue_Angles_HD.mp4 laredo:/Users/xxxxxx/tmp
Blue_Angles_HD.mp4                                                                    100%  125MB   2.0MB/s   01:03    
xxxxxx@waco:~/Documents$ logout
Connection to waco closed.
laredo:~ xxxxxx$ cd tmp
laredo:tmp xxxxxx$ ls -l
total 255320
-rw-r--r--  1 xxxxxx  staff  130720176 Jul  9 19:42 Blue_Angles_HD.mp4
laredo:tmp xxxxxx$ 


Last edited by pludi; 07-10-2010 at 11:42 AM.. Reason: code tags, please...
# 3  
Old 07-10-2010
Thanks for the reply. I thought I might have to enable ssh and use two shells at once. This isn't ideal for me, I don't want to have to enable ssh on my local computer, but thanks for the help.
# 4  
Old 07-10-2010
Quote:
Originally Posted by Colecf
Thanks for the reply. I thought I might have to enable ssh and use two shells at once. This isn't ideal for me, I don't want to have to enable ssh on my local computer, but thanks for the help.
While addressing your earlier problem, there's certainly no reason why you can't run your login shell and use something like FileZilla at the same time to copy files back and forth.

I recommend using FileZilla (FileZilla - Client Download). I you are looking for a good SSH shell for Windows, try Putty.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can i get the logged in host machine ip in a ssh connection?

Hi All, I have a basic question. In my system i maintained multiple unix server, and only one server has public ip, and all the servers are behind load balancing BIG ip server. To access any server, user need to access server with public IP then from there they can establish ssh connection to... (2 Replies)
Discussion started by: dilipsn
2 Replies

2. Shell Programming and Scripting

While loop not reading all files if ssh fails

The below while loop is in ksh on a SunOs server: SPARC-Enterprise 5.10 The ksh version is: Version M-11/16/88i The intention of the below while loop is to read through a list of file names in files.txt and delete each file from a server, one at a time. The delete works, the problem is that if... (6 Replies)
Discussion started by: LES2013
6 Replies

3. Shell Programming and Scripting

Copy multiple files from A to B through passwordless ssh

hi all, I need to write one script to copy multiple imp files like /etc/passwd /etc/group /etc/shadow /etc/printers.conf from system A, System B and system C to system Z and I need to execute this script on System Z. like if system is equal A copy 1 2 3 files to system Z into... (9 Replies)
Discussion started by: manalisharmabe
9 Replies

4. Shell Programming and Scripting

Remove files using ssh

Hi , I am trying to remove files using ssh login to other server but i am not able to delete files I am using below options: ssh username@"$Server" -t bash << EOF cd $location rm -rf `find . -name *.log.* -mtime +450` Server name I am picking from some other file and its correct rm command... (1 Reply)
Discussion started by: ankush_mehra
1 Replies

5. Shell Programming and Scripting

Transferring Files via ssh (bash)

I am trying to transfer my website using ssh(hostbasedauthentication) using: sudo ssh -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.3.1 "find /var/www/vhosts/mywebsite.com -depth | grep -f include| cpio -oavc| gzip" > $backup_dir/fullwwwsite$date.cpio.gz ... (5 Replies)
Discussion started by: metallica1973
5 Replies

6. Shell Programming and Scripting

HOW: Shell script accessing files located in individual logged in user.

Hi I have below scenario, I hope this could be possible, but as of now no idea how to implement this. Mount point in this location /abc/mp, and there will different users who will be executing one the file shell1.sh file located in /abs/mp, but every user will execute this shell1.sh file from... (1 Reply)
Discussion started by: shekharjchandra
1 Replies

7. Shell Programming and Scripting

Copying / SCPing the files

Hi All, Could you please help me out how can i copy the file from one system to another using scp. For example - i have systems A,B,C in one location And i have systems D,E,F in second location. Now, I wan to copy the files from Systems A->D, B->E, C->F using scp in loop or any condition... (5 Replies)
Discussion started by: sdosanjh
5 Replies

8. Solaris

Secure method - get files - no ssh/scp

I have two servers. server 1 - secure server running ssh only on solaris 9. I can installed whatever I need here as long as its reasonably secure server 2 - running telnet (no ssh/scp installed) - I cannot change much on this server and cannot install much.. I need to pull some files from... (3 Replies)
Discussion started by: frustrated1
3 Replies

9. UNIX for Dummies Questions & Answers

know who logged and logged out with their timings

being ordinary user (not having any administrative rights) can avail myself a facility to know who logged and logged out with their timings get popped onto my terminal as if it get echo 'ed... (3 Replies)
Discussion started by: vkandati
3 Replies
Login or Register to Ask a Question