LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Default permission on files/directory (https://www.linuxquestions.org/questions/linux-newbie-8/default-permission-on-files-directory-684638/)

wegadnie 11-19-2008 10:37 AM

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?

trickykid 11-19-2008 11:21 AM

chmod -r will recursively change all permissions. Be careful though, you might not want all files to be 755.

colucix 11-19-2008 11:48 AM

Recursive option to chmod is -R (uppercase). man chmod explains it all, anyway.

wegadnie 11-19-2008 07:28 PM

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)

osamaensyviswinkel 11-20-2008 12:29 AM

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.

wegadnie 11-20-2008 03:27 AM

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
else
umask 022
fi

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

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
fi
done
unset i
fi
# vim:ts=4:sw=4


All times are GMT -5. The time now is 05:29 PM.