Access Modes


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Access Modes
# 1  
Old 04-15-2011
Access Modes

What access modes (permissions) are given to new files you create?
# 2  
Old 04-15-2011
That's configurable. You set it with your umask. And what permissions you get depends on what permissions you ask for, too.
open("filename", O_RDWR|O_CREAT, 0000); will only create a file with 0000 permissions no matter what your umask is.

A file created with a umask of 000 can have up to 777 permissions, that is, rwxrwxrwx.

A file created with a umask of 022 can have up to 755 permissons, that is, rwxr-xr-x.

If you're creating these files with the shell, it will always strip the executable bits off. So even a umask of 000 would only create rw-rw-rw files.

You can set your umask in the shell like umask 0777 or in C like umask(0777)

When I login to my system I end up with a 022 umask by default.
# 3  
Old 04-16-2011
I applaud Corona688 for his/her knowledge and experience, but I don't think they explained it in layman's terms well enough. @ Corona688 - Kudos.

You might set your 'umask' in ~/.profile or maybe your shell specific version, for me it is ~/.bash_profile.

The umask setting is a subtractive octal value from 777 for dirs, and from 666 for files. For example, if your umask is set to 022, when you `mkdir mynewdir`, the directory has octal permissions of 755. And when you create a new file, the file has octal permissions of 644.

Hope that helped!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between non promiscous and promiscous modes in packet sniffing?

I am using a packet sniffing program. When i use the promiscous mode, i can see in the packets that there is an IP involved(192.168.1.73) in either "from" or "to", which is not my machine's IP( 192.168.1.185). However, in the non promiscous mode, only packets involving my machine's IP are... (1 Reply)
Discussion started by: syncmaster
1 Replies

2. Proxy Server

How to use Squid on Linux to control certain IP to access Web Server and certain IP cannot access?

Dear all experts here, :) I would like to install a proxy server on Linux server to perform solely to control the access of Web server. In this case, some of my vendor asked me to try Squid and I have installed it onto my Linux server. I would like know how can I set the configuration to... (1 Reply)
Discussion started by: kwliew999
1 Replies

3. Solaris

samba read write access to owner and no access to other users

Hi All, I want to configure samba share permission so that only directory creator/owner has a read and write permission and other users should not have any read/write access to that folder.Will that be possible and how can this be achieved within samba configuration. Regards, Sahil (1 Reply)
Discussion started by: sahil_shine
1 Replies

4. Shell Programming and Scripting

vim Script: Switching between modes

Hi All, I've been using vi for about 10 years, but this is my first attempt at creating a vi script. I am reformatting some files to create CSVs for import into a database. In the script, I have a bunch of substitute lines that work fine, but I'm trying to figure out how to get the script into... (3 Replies)
Discussion started by: dkr
3 Replies

5. UNIX for Dummies Questions & Answers

kernel giving access for multiple users to access files

hi all, i want to know y kernel is giving access for multiple users to access a file when one user may be the owner is executing that file. Because other user can manipulate that file when the other user is executing that file, it will give the unexpected result to owner . plz help me... (1 Reply)
Discussion started by: jimmyuk
1 Replies

6. Shell Programming and Scripting

KSH switches editin modes when cycling through history. Why?

Hello all, Working in KSH using Solaris, the default editor is VIM. So, per session, I run a small rc script which calls export editor=emacs This works for commands at the prompt. But if I cycle through command history (Using the up arrow) the command line editor defaults to VIM. How can I... (2 Replies)
Discussion started by: eggmatters
2 Replies

7. Post Here to Contact Site Administrators and Moderators

different modes?

What are the Guided and Enhanced Modes? This is something new right? Or have I been the most unobservant guy on the face of this planet? At first I thought it was something for Gollum the forumbot, but its there everytime you start a new thread. What is the difference between the two? And how do... (1 Reply)
Discussion started by: blowtorch
1 Replies

8. UNIX for Advanced & Expert Users

linux communications modes

what r the ways in which a linux application communicate with an external system like linux or windows? (1 Reply)
Discussion started by: shil
1 Replies

9. UNIX for Dummies Questions & Answers

Need help to access/mount so to access folder/files on a Remote System using Linux OS

Hi I need to access files from a specific folder of a Linux system from an another Linux System Remotely. I know how to, Export a folder on One SCO System & can access the same by using Import via., NFS in the Sco Unix SVR4 System using the scoadmin utility. Also, I know to use mount -t ... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies
Login or Register to Ask a Question