Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-19-2008, 11:37 AM   #1
Registered: Oct 2007
Posts: 48

Rep: Reputation: 15
Default permission on files/directory

Hi all,

I have a server, it worked well until last week when we lose default permission for new files/directory which were created by users. On this box i have more than 50 users.

Normally when user create a new file in their home directory (this directory's also a ftp folder/website directory), default permission on file should be 755 but now the permission has been replaced by 711 and it causes other people can not access their website. It can fix by change permission on all file to 755 but i can't do manually.

Run umask it shows me 0022 which is the correct want. Any body now anything about this?
Old 11-19-2008, 12:21 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
chmod -r will recursively change all permissions. Be careful though, you might not want all files to be 755.
Old 11-19-2008, 12:48 PM   #3
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Recursive option to chmod is -R (uppercase). man chmod explains it all, anyway.
Old 11-19-2008, 08:28 PM   #4
Registered: Oct 2007
Posts: 48

Original Poster
Rep: Reputation: 15
I know i can execute chmod with -R option to recursive set permission on files/folder but the problem is I can not execute this command everytime. I need when user creates new files/folder it will automatically has default permission (755 in this case)
Old 11-20-2008, 01:29 AM   #5
LQ Newbie
Registered: Sep 2007
Location: Stellenbosch, South Africa
Distribution: Ubuntu 12.10 at home, Mac OS X on laptop
Posts: 20

Rep: Reputation: 0
Type umask to see what the value is that it returns. On redhat/fedora systems you should find the umask settings in the /etc/bashrc file.
Old 11-20-2008, 04:27 AM   #6
Registered: Oct 2007
Posts: 48

Original Poster
Rep: Reputation: 15
the umask command return 0022 and umask -S command returns u=rwx,g=rx,o=rx and this is right but i still can not make the default permission is 755 for new file and directory which was created by users. I have checked bashrc but i don't think i can figure out what is in this file. i post my file on here but i don't think it won't help as it is the same on another machine.

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
umask 022

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if ! shopt -q login_shell ; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
unset i
# vim:ts=4:sw=4


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set default permission for files uploaded? neocontrol Linux - Security 1 01-25-2008 04:04 PM
default access permission when we copy files bluenectar Linux - General 2 03-04-2007 10:09 PM
Can I set default file/directory permission levels? toes Linux - Security 5 01-05-2007 07:21 PM
Default home directory permission kumarsundaram Linux - Security 14 06-30-2005 08:33 PM
Default home directory permission in SUSE 9.1 soldonz Linux - Security 1 05-26-2005 06:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration