Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > SSH transfer // "No such file or directory" locally?

SSH transfer // "No such file or directory" locally?
Thread Tools
Dedicated MacNNer
Join Date: Jun 2001
Location: Xanadu Roller Palace, Chicago
Status: Offline
Reply With Quote
Jun 15, 2004, 03:14 PM
 
I can ssh to the webserver, and i simply want to move a directory from my local machine, to this new remote server. I have root access and i modify and delete and make directories. When i try to move a file from my machine to the server, terminal tells me "No such file or directory," but all i am doing is dragging the file into the terminal so it types out the path for me.

Help? All i need to do is transfer this one directory and it is driving me insane. It seems like it is a local issue with terminal. Your help is greatly appreciated.

Thanks.
     
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status: Offline
Reply With Quote
Jun 15, 2004, 07:39 PM
 
Originally posted by + spiral +:
I can ssh to the webserver, and i simply want to move a directory from my local machine, to this new remote server. I have root access and i modify and delete and make directories. When i try to move a file from my machine to the server, terminal tells me "No such file or directory," but all i am doing is dragging the file into the terminal so it types out the path for me.

Help? All i need to do is transfer this one directory and it is driving me insane. It seems like it is a local issue with terminal. Your help is greatly appreciated.
Well dragging and dropping a file from your local Mac OS X machine to a terminal that is logged in to a remote machine via ssh is "meaningless". This is because... when you drag and drop a file (or folder) from you local Mac to a terminal that is also logged in to your local Mac it "makes sense" because that actual file or folder actually exists on the local Mac.
When you drag and drop a file or folder from your local Mac to a terminal that is logged in to remote machine the remote machine may have an entirely different file system layout than your Mac does. Even with identical layouts it wouldn't work because an ssh terminal session does not transfer files. It only* transfers text to/from the kybd and the screen.

In order to transfer files and folders you should use scp.

Code:
scp -r /path/to/folder user@host:/path/to/destination
This will recursively copy the entire folder from your local Mac to the remote server. See man scp for more details. You should be able to type "scp -r" (without the quotes) in a local terminal and then drag and drop a local folder to the terminal... which should fill in the "/path/to/folder" part. The "user@host:" part is kinda obvious... could be "root@mywebserver.com:" (or whatever). Don't forget the ":". You could even drag and drop the last "/path/to/destination" but only if that path also exists on the servers filesystem.

Now... if you do this fairly often then the above is a bit of handful to type every time you need to transfer a file or folder. A more intelligent way would be to use rsync. Something like this:

Code:
rsync -auvz --progress --stats -e ssh /path/to/folder user@host:/path/to/destination
The above will only transfer the changes you have made in the local folder where you keep all your website stuff to the remote folder on the server. It is very fast and efficient way to do it especially if you have a largish website. Other than the options the syntax is identical to scp. See man rsync for more info.
Of course, the above is even more of a handful to type in your terminal so the best thing would be to make an alias for the command or a simple shell script. If you make it a shell script or alias all you have to do is type:

./mirror-web

or whatever you called the script or alias and it will do the rest for you. Doing itthis way makes it fast, efficient, complete and you never have to worry about dragging and dropping anything again or forgetting to transfer some of the changes.

If you are interested I can post a script that will add some more cool features such as logging and backups.

*well... you can also run a remote X windows app and have it display locally.
-DU-...etc...
     
Senior User
Join Date: Apr 2002
Status: Offline
Reply With Quote
Jun 15, 2004, 09:23 PM
 
Originally posted by + spiral +:
I can ssh to the webserver, and i simply want to move a directory from my local machine, to this new remote server. I have root access and i modify and delete and make directories. When i try to move a file from my machine to the server, terminal tells me "No such file or directory," but all i am doing is dragging the file into the terminal so it types out the path for me.
You may find it's easiest to use a graphical SCP/SFTP client such as Fugu. It's free and can be found here.
     
Dedicated MacNNer
Join Date: Jun 2001
Location: Xanadu Roller Palace, Chicago
Status: Offline
Reply With Quote
Jun 16, 2004, 09:56 AM
 
Originally posted by utidjian:
In order to transfer files and folders you should use scp.

Code:
scp -r /path/to/folder user@host:/path/to/destination
This will recursively copy the entire folder from your local Mac to the remote server. See man scp for more details. You should be able to type "scp -r" (without the quotes) in a local terminal and then drag and drop a local folder to the terminal... which should fill in the "/path/to/folder" part.
This is what i tried before and i tried again now. It keeps saying "No such file or directory." Could it be a firewall thing? I'm typing the exact syntax you are, at the % prompt. No love. Thanks for the long reply.

Thanks for the Fugu tip. I actually tried that too and it didn't work.
     
Mac Enthusiast
Join Date: Jan 1999
Location: Marietta, GA, USA
Status: Offline
Reply With Quote
Jun 16, 2004, 10:02 AM
 
Does the path name have a space in it? If so, you'll need to put the path in quotes, or escape the spaces, like this:

/Users/scott/Documents/My\ Folder\ With\ Spaces/

or

'/Users/scott/Documents/My Folder With Spaces'
Scott Genevish
scott AT genevish DOT org
     
Dedicated MacNNer
Join Date: Jun 2001
Location: Xanadu Roller Palace, Chicago
Status: Offline
Reply With Quote
Jun 16, 2004, 10:14 AM
 
Here is what i am typing:

[code]
%scp -r /Users/spiral/Documents/WORK/clientname/backup/data/Merchant2/modules.dbf usr@111.111.111.111:usr/local/www/vhosts/clientname/mivadata/Merchant2/modules.dbf
[code]

After i type in the password i get:
[code]
/Users/spiral/Documents/WORK/clientname/backup/data/Merchant2/modules.dbf: No such file or directory
[code]

     
Mac Enthusiast
Join Date: Jan 1999
Location: Marietta, GA, USA
Status: Offline
Reply With Quote
Jun 16, 2004, 10:34 AM
 
I'm not at my computer right now to check it, but a few notes. The last part of it may need an initial slash:

usr@111.111.111.111:/usr/local/www/vhosts/clientname/mivadata/Merchant2/

Also, try this to verify the path is valid:

touch /Users/spiral/Documents/WORK/clientname/backup/data/Merchant2/modules.dbf

Also, I think you just need the destination directory name, not the file name.

And lastly, try running it with sudo:

Code:
sudo scp -r /Users/spiral/Documents/WORK/clientname/backup/data/Merchant2/modules.dbf usr@111.111.111.111:/usr/local/www/vhosts/clientname/mivadata/Merchant2/
Scott Genevish
scott AT genevish DOT org
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:53 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2