?
Solved

Unix File permission

Posted on 2006-05-06
4
Medium Priority
?
292 Views
Last Modified: 2010-04-21
Hi,

Is there a way, whereby I can create files that have a write permission for the group as a default setting. The files I create using my Id, normally are only read-only for the group.

Thanks.
0
Comment
Question by:Chirag_Bhatnagar
  • 3
4 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 16622118
Hi Chirag_Bhatnagar,

> Is there a way, whereby I can create files that have a write permission
> for the group as a default setting. The files I create using my Id,
> normally are only read-only for the group.
change your umask

umask 0002 would make new defaults
rwx rwx r-x

Cheers!
Sunnycoder
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 16622126
Hi Chirag_Bhatnagar,

Also refer to the umask man page
http://www.die.net/doc/linux/man/man1/umask.1.html

Cheers!
Sunnycoder
0
 
LVL 3

Accepted Solution

by:
root_start earned 1000 total points
ID: 16647669
Hi Chirag_Bhatnagar,

I am not sure if you know what is the /etc/profile: this file is loaded every time a user logs to the unix system and all environment variables and commands that are default to all users can be in this file, so you will not need to set them in each profile.

Now about the umask, you can set a default one in the "/etc/profile".

Also, you must check in the users profile(.profile in users' home directory) if there is no umask that overrides the one in the /etc/profile, and you can do this with the following commads:
=====================================================================
# cat /etc/passwd | awk -F":" '{print $6}'|xargs -i grep –l umask {}/.profile
# grep –l umask /etc/skel/.profile
# grep –l umask /etc/skel/.cshrc
# grep –l umask /etc/skel/.login
=====================================================================

A good umaks could be: umask 027 - permission: 750

I hope it helps. =0)
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 16647919
>I can create files that have a write permission for the group as a default setting
I believe it would be safer to have this setting in specific user profile rather than in system wide common profile file
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question