"No such file or directory"

funnyVillain

New Member
Joined
Feb 8, 2021
Messages
6
Reaction score
0
Credits
59
Hi there! I'm trying to copy some file from local to remote. But it doesn't work yet the way it should.
Have a look at my shell actions:

Code:
// what's in the home directory currently?

root@h2923319:~# cd
root@h2923319:~# ls -ltra
insgesamt 52
-rw-r--r--  1 root root 3106 Aug 14  2019 .bashrc
-rw-r--r--  1 root root   20 Feb  8 12:32 .screenrc
-rw-r--r--  1 root root  223 Feb  8 12:38 .plesk_banner
-rw-r--r--  1 root root  195 Feb  8 12:38 .profile
drwx------  2 root root 4096 Feb  8 12:42 .autoinstaller
-rw-r--r--  1 root root   45 Feb  8 12:42 .autoinstallerrc
drwxr-xr-x 23 root root 4096 Feb  8 12:46 ..
drwx------  2 root root 4096 Feb  8 15:34 .cache
-rw-r--r--  1 root root    0 Feb  8 15:52 testdatei
drwx------  2 root root 4096 Feb  8 17:21 .ssh
drwxr-xr-x  2 root root 4096 Feb  8 18:26 test_directory
-rw-------  1 root root 1394 Feb  8 20:41 .bash_history
drwx------  7 root root 4096 Feb  9 03:16 .
drwxr-xr-x  8 root root 4096 Feb  9 03:22 parallels

// Here I try to copy the file from my computer to the server (to home):

root@h2923319:~# scp /Users/chrisxxx/Library/Mobile 
Documents/com~apple~CloudDocs/Downloads/Text.html [email protected]:/home/test_directory

[email protected]'s password:

// password has been entered

// directory can't be found:

scp: /home/test_directory: No such file or directory


Does anybody see what I'm doing wrong? This would be really great! Thanks a lot to all of you!

Greetings,
Chris
 


Moving this to Command Line.

Cheers

Wizard
 
Your directory settings look wonky. Are those actually the directories?

For example, you have a capital U in users. You have /home/test_directory, when it's usually /home/<user account name>/<some directory>.
 
I think '/home/test_directory' is the problem. It doesn't exist. You want to copy to a test_directory WITHIN some user's home directory which would be '/home/user_name/test_directory'.

Also, in cases like these you might want to SSH over to the remote machine and check if the directory exists......

keith
 
Hi, thanks a lot to both of you!!

May I ask:

- how to switch between two machines?

- I found examples like that on the internet:
file.txt [email protected]:/home/directory
So you say, I should move "remote_username" (oder "[email protected]") and put it between "home" and "directory"?

___________
Actually I managed to transfer the file even before I read your two replies. Perhaps the problem was between @User and @root.
But however: it doesn't complain anymore when I do "scp", but the file doesn't seem to be transfered either ...

Greetings from Munich
Chris :)
 
Okay,
On almost all Linux systems user have home directories setup in a directory called /home. So, for instance user 'steve' would probably have a home directory called '/home/steve' WITHIN this directory, steve might have other directories and files i.e. 'documents', 'desktop', myprog.c, doit.py, etc.
So in your example you've tried to scp files to a remote server and into root's '/home/test_directory' which doesn't exist. If you wanted to put it into a place like that it would probably be root's directory called '/home/root/test_directory' (this may also be probelematic because I don't know if root typically gets a directory in '/home'.
So, what I suggested that you do is to ssh to the remote machine (ssh root@<ip of remote server>) and see what subdirectories are available to root.
Having said THAT, you probably don't want to be doing any of this stuff as 'root' or in 'root's' directories. You probably want to get access to a userid or get your own account on the remote server (whichever makes sense for your situation) and copy your stuff to a more appropriate directory.

keith
 
Code:
(base) My-MacBook-Pro:tests myname$ scp test.txt [email protected]:/home/test_directory:
[email protected]'s password:

This is the code (working on the local, not on the remote machine) not complaining, but not working either.

No you should do something like this. Get an account on the remote machine (talk to your sysadmin about doing this for you). Once you're setup, you should have a home directory. Let's say your username is 'ralph'. So there should be a /home/ralph directory on the remote machine.
Then do: ssh [email protected] (btw, I wouldn't use real ip addresses in your notes here) and you'll end up logged onto the remote system as yourself, in /home/ralph. Now do, 'mkdir test_directory'. You have just created your test_directory.
Now logout (ctrl c) and you'll be back in your original session. Now you can do 'scp test.txt [email protected]6:/home/test_directory.
You can then ssh back to the remote machine to check that your file(s) is there.
 
Yep - I agree with khedger. Test your remote connection first with ssh. Then cd into the directory where you want to copy things and run a pwd to see the directory path. Then use that path in your macbook when you're using scp as the remote directory.
 

Members online


Latest posts

Top