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?
# 1  
Old 10-02-2010
Question chmod to stop cat from displaying 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.??

Last edited by Scott; 10-04-2010 at 07:50 AM.. Reason: Font and size changed
# 2  
Old 10-02-2010
Code:
chmod 000 MyFile

Smilie
# 3  
Old 10-04-2010
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:
Code:
 
chmod u+r,g=0,o=0 "Yourfile"

# 4  
Old 10-04-2010
if u want only the file owner to display the file , while the others can not,maybe the below can help u:
Code:
chmod 1700 Filename

# 5  
Old 10-04-2010
Quote:
Originally Posted by raghu_shekar
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:
Code:
 
chmod u+r,g=0,o=0 "Yourfile"

I do not think that is a valid command

Quote:
Originally Posted by vivisquirrel
if u want only the file owner to display the file , while the others can not,maybe the below can help u:
Code:
chmod 1700 Filename

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:
Code:
chmod -r MyFile

# 6  
Old 10-04-2010
To make the file only readable by the owner or root.

Code:
chmod u=rw,g=-rwx,o=-rwx MyFile

or

chmod 600 MyFile

# 7  
Old 10-04-2010
To make the file only readable by the owner, the command would be:
Code:
chmod go-r MyFile

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