Hi,
Im struggling with what chmod to change the permission of a file in the current directory named MyFile so the command "cat MyFile" fails to display the file.??
Hi,
Im struggling with what chmod to change the permission of a file in the current directory named MyFile so the command "cat MyFile" fails to display the file.??
chmod 000 MyFile
I am assuming that you do not want OTHERS to be able to see your file using CAT but you should be able to... in that case you can use:
chmod u+r,g=0,o=0 "Yourfile"
if u want only the file owner to display the file , while the others can not,maybe the below can help u:
chmod 1700 Filename
I do not think that is a valid command
The sticky bit (1000) has no function on a file in modern implementations.
---------- Post updated at 14:17 ---------- Previous update was at 14:14 ----------
It is not clear what you mean. This would take away all read permissions:
chmod -r MyFile
To make the file only readable by the owner or root.
chmod u=rw,g=-rwx,o=-rwx MyFile
or
chmod 600 MyFile
To make the file only readable by the owner, the command would be:
chmod go-r MyFile
chmod u+r,g=0,o=0 "Yourfile"
is very much a valid command and it sets rwx permission to the owner of the file(assuming its already with 777 permission) and --- to the group and others. I have used this command myself and works like a charm. I find this method easier than the numbers..
I get
$ touch somefile
$ chmod u+r,g=0,o=0 somefile
chmod: invalid mode: `u+r,g=0,o=0'
Try `chmod --help' for more information.
It might be working in your particular environment, but it is not universal. Does this work on your system:
chmod u+r,go= somefile
$>touch somefile
$>chmod u+r,g=0,o=0 somefile
$>ls -lrt somefile
-rw------- 1 G G 0 Oct 5 2010 somefile
Also
chmod u+r,go= somefile
works fine and gives the same result as my command...
I am on RedHat
Remember for super user, permission bits are not checked.
That is, if you have 000 permission for a file, a super can cat the file.