LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Under linux how to set the attribute of a file to make it hidden? (https://www.linuxquestions.org/questions/linux-newbie-8/under-linux-how-to-set-the-attribute-of-a-file-to-make-it-hidden-719217/)

zhaohuiyu2 04-15-2009 02:38 AM

Under linux how to set the attribute of a file to make it hidden?
 
I have a USB hard disk, the file system of it is NTFS.
I mount the USB hard disk under Linux through the ntfs-3g driver in order to READ/WRITE.
What I want to do is to create a file on the USB hard disk and set it attributes to make it hidden so that when I plug back the USB hard disk into windows system, the user can't see the hidden file.
I just don't know how to achieve this.
Any help is appreciated.

repo 04-15-2009 02:43 AM

jut add a "." (period) at the beginning of the file name
ie
Code:

.hidden_file

zhaohuiyu2 04-15-2009 02:50 AM

I tried this method already.
It make the file hidden under Linux with no problem.
but when you plug back the USB hard disk onto the windows system,
you will see the file created. It is not hidden.

repo 04-15-2009 02:54 AM

make it hidden in windows ?

I don't think ntfs-3g has an option to create hidden files.

jschiwal 04-15-2009 02:59 AM

You can't change permissions or attributes of files on an ntfs mounted partition. They are determined by the mount command options.
You could change the attributes from windows however.

If you are offering a share with windows machines, then use a native linux filesystem and map dotted files to hidden ones.

zhaohuiyu2 04-15-2009 03:15 AM

Quote:

Originally Posted by jschiwal (Post 3509347)
You can't change permissions or attributes of files on an ntfs mounted partition. They are determined by the mount command options.
You could change the attributes from windows however.

If you are offering a share with windows machines, then use a native linux filesystem and map dotted files to hidden ones.


I see. Thank you very much.
anthoer question:
How to map dotted files to hidden ones?

mrrangerman 04-15-2009 04:16 AM

In windows right click on the file go to properties select make hidden, you will also have to open windows explore go to tools > folder options > view then make sure that it is checked to not show hidden files.

jschiwal 04-15-2009 09:09 AM

In the samba share definition, use "hide dot files = yes".


All times are GMT -5. The time now is 12:05 AM.