6

I have a problem with a directory. If I run a ls -la I get following output:

/rwx------    7 1000     1000          4.0k Mar  1 09:11 Folder Name

It is supposed to be a folder. What does the slash mean in the permissions? I expected a d since it is a folder.

I have this problem on my QNAP Nas. uname -a shows Linux Q 3.19.8 #1 SMP Mon Feb 13 05:20:15 CST 2017 x86_64 unknown

I cannot access the folder or set other permissions / owners.

chown admin:administrators Folder\ Name -> chown: Folder Name: No such file or directory

chmod 777 Folder\ Name -> chmod: Folder Name: No such file or directory

cd Folder\ Name -> -sh: cd: Folder Name: No such file or directory

mv Folder\ Name other_name -> mv: unable to rename Folder Name: No such file or directory

--- Background:

I copied this folder via rsync from an ubuntu to my nas using:

rsync -ahhve "ssh" /home/foo/bar/ admin@10.0.0.1:"/share/homes/username/Folder\ Name"

Thank you for reading this question and I am happy for any help.

  • Can you see its attributes with stat *? – dirkt Mar 1 '17 at 15:38
  • Gordon Davisson provided the solution in an answer beneath. I got it working by a workaround: I opened the webinterface in my QNAP and used the File Station to rename the folder. After renaming, it had the d in the permissions list and I could access it. – cPu Mar 2 '17 at 20:37
10

This is a guess, but... I suspect there's a carriage return at the end of the folder's name. Depending on the exact ls command you're using, it may be putting / at the end of the folder name but the carriage return makes that show up at the beginning of the line, overwriting the d that'd normally be there. Try listing it with ls -l | cat -vet, which will translate normally-invisible characters into visible ones. If I'm right, it'll show up as something like:

$ ls -l | cat -vet
drwx------    7 1000     1000          4.0k Mar  1 09:11 Folder Name^M$

(where the ^M represents the carriage return, and the $ is the end of line marker.)

If I'm right you can fix it by renaming and using bash's tab completion to get the name right. Type in something like mv Folder<tab> and it should fill in the rest of the name including nonprinting characters; then enter a new (corrected) name for it and you should be ok.

  • Thank you very much! This is the solution. Good job! I used <tab> for bash completion in the first place, but I had this folder already without the invisible tab and thats why I could not see it. – cPu Mar 2 '17 at 20:33
  • 1
    ls -lb should work as well. – kasperd Mar 25 '17 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.