Created a user through the console and also created a folder for him. What could be the problem and how to solve it?

$ ls -l /home/ итого 12 drwxr-x--- 6 nas-scanner root 4096 июн 26 15:32 nas-scanner $ ls -l /home/nas-scanner итого 8 -rw-rw-r-- 1 nas-scanner nas-scanner 4 июн 26 15:32 123.txt drwxrwxrwx 2 nas-scanner nas-scanner 4096 июн 26 13:37 scanner echo "123" >> /home/nas-sacanner/scanner/123/123 -sh: 15: cannot create /home/nas-sacanner/scanner/123/123: Directory nonexistent 

    1 answer 1

    You are trying to write to the directory 123 , which does not exist. Do this:

     $ echo "123" >> /home/nas-scanner/scanner/123.txt 

    if you go write to the 123.txt file in the scanner directory or

     $ echo "123" >> /home/nas-scanner/scanner/123 

    if you go write to file 123 in the scanner directory

    Or, if you still need to write to the directory 123 , first create it:

     $ mkdir /home/nas-scanner/scanner/123 $ echo "123" >> /home/nas-scanner/scanner/123/123 

    UPD. Fixed nas-sacanner on nas-scanner

    • You are mistaken, the team either creates the file and adds the source text to it, or simply adds the source text. You can check on your virtual machine. Files in linux do not necessarily have an extension. - shaman888
    • @ shaman888, the fact is that the echo command does not see the missing 123 directory, precisely because of this error. - zombic
    • I still tried with the correct paths and indicating the extension, but it did not help. In cases where the folder is missing, the corresponding error is displayed. echo "123" >> 1232312/123 bash: 1232312/123: There is no such file or directory - shaman888
    • Let's do this: ls -l /home/nas-sacanner/scanner/ , and then echo "123" >> /home/nas-sacanner/scanner/123 . Show what happens. - zombic
    • ls -l / home / nas-scanner / scanner / total 4 drwxrwxr-x 2 nas-scanner nas-scanner 4096 Jun 26 15:40 123 echo "123" >> / home / nas-sacanner / scanner / 123 -sh: 6: cannot create / home / nas-sacanner / scanner / 123: Directory nonexistent echo "123" >> /home/nas-sacanner/scanner/123/123.txt -sh: 9: cannot create / home / nas-sacanner /scanner/123/123.txt: Directory nonexistent - shaman888