chmod to stop cat from displaying the file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting chmod to stop cat from displaying the file?
# 8  
Old 10-05-2010
Code:
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.. Smilie
# 9  
Old 10-05-2010
I get
Code:
$ 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:
Code:
chmod u+r,go= somefile

# 10  
Old 10-05-2010
Code:
$>touch somefile
$>chmod u+r,g=0,o=0 somefile
$>ls -lrt somefile
-rw-------    1 G G        0 Oct  5  2010 somefile

Also
Code:
chmod u+r,go= somefile

works fine and gives the same result as my command... Smilie

I am on RedHat
# 11  
Old 10-06-2010
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem while displaying(cat) file content inside telnet loop .

Hi Team, Not getting the file output inside my email which i am sending from unix box. . Please refer the below code : #!/bin/sh { sleep 5 echo ehlo 10.56.185.13 sleep 3 echo mail from: oraairtel@CNDBMUREAPZP02.localdomain sleep 3 echo rcpt to: saurabhtripathi@anniksystems.com... (1 Reply)
Discussion started by: tripathi1990
1 Replies

2. Post Here to Contact Site Administrators and Moderators

How can i stop displaying Bits/banking with my account?

How can i stop displaying Bits/banking with my account? (1 Reply)
Discussion started by: cola
1 Replies

3. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

4. Shell Programming and Scripting

File permission by chmod

Hi, I have a typical problem. Consider the scenario: Folder1 ------> Folder2 ------> File1 ------> Folder3 Above is my folder structure, currently the user group "other" has no permissions. I wish to give "read" permission for "others" to File1 using a single command. chmod -R... (5 Replies)
Discussion started by: animesh303
5 Replies

5. UNIX for Dummies Questions & Answers

chmod remote server file

I would like to chmod the file which I am pulling from remote server onto my server. I am using the following script: sftp <server detail> get abc xyz chmod 666 xyz bye Though I could fetch the file successfully but I am not able to change the permission of xyz file on my server. Pls... (5 Replies)
Discussion started by: kdtrica
5 Replies

6. UNIX for Dummies Questions & Answers

chmod of remote file

I would like to chmod the file which I am pulling from remote server onto my server. I am using the following script: sftp <server detail> get abc xyz chmod 666 xyz bye Though I could fetch the file successfully but I am not able to change the permission of xyz file on my server. umask... (1 Reply)
Discussion started by: kdtrica
1 Replies

7. Programming

chmod:No such file or directory

sprintf(fname, "core.%d", pid); (void) unlink(fname); if (ttrace(TT_PROC_CORE, pid, 0, 0, 0, 0) != 0) { perror("TT_PROC_CORE pass"); Fail(); } if (chmod(fname, 0) != 0) { perror("chmod"); Fail(); } Hi, If i execute above code,everytime am getting below... (1 Reply)
Discussion started by: mansa
1 Replies

8. Solaris

Unable to chmod a file/directory

This is Solaris 10, by the way. I am aware of ACLs or something like that in Solaris 10 where you can change who can access directories and such that goes beyond the standard permisisons (chmod and rwxrwxrwx). Although I thought when these were being used, the permissions listing would show a... (12 Replies)
Discussion started by: lyonsd
12 Replies

9. Shell Programming and Scripting

use a file to chmod

Hi! I need help becouse I've server to backup and I've a lot of files with 700 permission and I need to change the mode to 755 before copy So the point is. With find . -perm 700 -exec echo {} > textfile.txt \; I got a text file with 3156 line which one... (3 Replies)
Discussion started by: ruben.rodrigues
3 Replies

10. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies
Login or Register to Ask a Question