"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?

[email protected]:~# cd
[email protected]:~# 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):

[email protected]:~# 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
 


wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
6,612
Reaction score
5,370
Credits
19,520
Moving this to Command Line.

Cheers

Wizard
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
4,001
Reaction score
3,678
Credits
32,149
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>.
 

khedger

Active Member
Joined
Jun 7, 2019
Messages
152
Reaction score
85
Credits
1,294
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
 
OP
F

funnyVillain

New Member
Joined
Feb 8, 2021
Messages
6
Reaction score
0
Credits
59
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 :)
 

khedger

Active Member
Joined
Jun 7, 2019
Messages
152
Reaction score
85
Credits
1,294
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 [email protected]<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
 

khedger

Active Member
Joined
Jun 7, 2019
Messages
152
Reaction score
85
Credits
1,294
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.
 

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
841
Reaction score
1,599
Credits
627
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.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Staff online

Members online


Top