LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-23-2007, 05:42 PM   #16
libin88
LQ Newbie
 
Registered: Jul 2005
Posts: 20

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by lakris View Post
Can You do the following commands:

What is Your output?
I have exactly same output as yours.

[root@server ~]# umask
0022
[root@server ~]# umask -p
umask 0022
[root@server ~]# umask -S
u=rwx,g=rx,o=rx
[root@server ~]# umask 0077
[root@server ~]# umask -p
umask 0077
[root@server ~]# umask -S
u=rwx,g=,o=
[root@server ~]# touch testfile
[root@server ~]# ll testfile
-rw-rw-rw- 1 root root 0 Aug 23 17:40 testfile


My /etc/profile is

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
unset pathmunge



My /etc/bashrc is,

# /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.
umask 022

# 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/~}"; echo -ne "\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/#$H OME/~}"; echo -ne "\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
# Need to redefine pathmunge, it get's undefined at the end of /etc/prof ile
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
unset pathmunge
fi
# vim:ts=4:sw=4

Last edited by libin88; 08-23-2007 at 05:51 PM.
 
Old 08-23-2007, 05:51 PM   #17
lakris
Member
 
Registered: Sep 2004
Location: Stockholm, Sweden
Distribution: Ubuntu, RedHat, SuSe, Debian, Slax
Posts: 102

Rep: Reputation: 15
Just guessing,
try to do it in a different directory and/or as a different user...
just to get a clue.
I'm off to bed now but I'll be back tomorrow (in 10 hours)
 
Old 08-23-2007, 05:54 PM   #18
libin88
LQ Newbie
 
Registered: Jul 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lakris View Post
Just guessing,
try to do it in a different directory and/or as a different user...
just to get a clue.
I'm off to bed now but I'll be back tomorrow (in 10 hours)
It is still the same.
 
Old 08-23-2007, 08:08 PM   #19
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
What happens if you do 'chmod 444' on an existing file?
 
Old 08-23-2007, 11:07 PM   #20
libin88
LQ Newbie
 
Registered: Jul 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ilikejam View Post
What happens if you do 'chmod 444' on an existing file?
The file permission will become -r--r--r--
 
Old 08-24-2007, 08:36 AM   #21
lakris
Member
 
Registered: Sep 2004
Location: Stockholm, Sweden
Distribution: Ubuntu, RedHat, SuSe, Debian, Slax
Posts: 102

Rep: Reputation: 15
Well, I don't have a clue. Now I've tried the same things on Debian, Ubuntu, Suse and redhat. They all behave correctly.

I am sorry I can't help. Maybe something to do with pam? Or log.defs in /etc?
 
Old 08-24-2007, 08:51 AM   #22
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Quote:
Originally Posted by libin88 View Post
The file permission will become -r--r--r--
So you can modify the permissions on existing files, but umask doesn't work? Weird.

Could you post the output from:
Code:
grep ' '`df -kl /root | tail -n 1 | awk '{print $6}'`' ' /proc/mounts
Dave
 
Old 08-24-2007, 10:53 AM   #23
libin88
LQ Newbie
 
Registered: Jul 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ilikejam View Post
So you can modify the permissions on existing files, but umask doesn't work? Weird.

Could you post the output from:
Code:
grep ' '`df -kl /root | tail -n 1 | awk '{print $6}'`' ' /proc/mounts
Dave

It is right, I can modify the permission on existing file, but umask doesn't work. Here is my output

rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0

Last edited by libin88; 08-24-2007 at 10:57 AM.
 
Old 08-24-2007, 11:03 AM   #24
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Blog Entries: 2

Rep: Reputation: 68
May be your command "umask" is an alias or a function defined with a misbehavior.
To check if umask is defined as an alias, run "alias | grep -i umask" and to check if it is defined as a function, run "declare -f".
 
Old 08-24-2007, 11:07 AM   #25
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Buh? I was hoping for some weird mount options or something, but that looks perfectly normal.

Dave
 
Old 08-24-2007, 11:34 AM   #26
libin88
LQ Newbie
 
Registered: Jul 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by marozsas View Post
May be your command "umask" is an alias or a function defined with a misbehavior.
To check if umask is defined as an alias, run "alias | grep -i umask" and to check if it is defined as a function, run "declare -f".
"alias | grep -i umask" got nothing, run "alias", I got

alias cp='cp -i'
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'


"declare -f umask" got nothing neither.
 
Old 08-28-2007, 05:00 PM   #27
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
How are you creating the new files?
 
  


Reply


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
When and why to use Umask ? tofee Linux - Newbie 4 11-26-2009 10:21 AM
Umask metallica1973 Linux - Software 4 11-27-2005 02:21 PM
Umask in .bash_profile stopped working mariusak Linux - Newbie 5 06-03-2005 09:05 AM
umask trophy Linux - General 1 04-03-2004 02:17 AM
vsftpd umask not working k-bot Linux - Software 1 03-10-2004 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:41 AM.

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