LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-20-2012, 11:00 AM   #1
scam
Member
 
Registered: Jun 2011
Location: UK
Distribution: Slackware 13.1, Slackware 13.37
Posts: 92

Rep: Reputation: Disabled
Permissions problem


Hi all, earlier installed slackware, then created a user and logged into to it and started X. I downloaded terminator from slackbuilds, i didn't use sbopkg, anyway it created the package in /tmp. I did installpkg /tmp/terminator* and afterwards user lost commands, my fluxbox menu have just had exit on it...i was wondering if editing /etc/profile umask to 077 from 022 could do this. i also got
zshermission denied:/var/spool/mail/user , to solve this i removed terminator package and reinstalled matamail package..anyone have any ideas?

Thanks
 
Old 01-20-2012, 12:32 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Quote:
Originally Posted by scam View Post
i was wondering if editing /etc/profile umask to 077 from 022 could do this.)
Yep. I know you didn't use sbopkg but the first msg or two of issue 57 should be relevant. I'm sure a search for sane root umasks in Slackware will also turn up stuff.
 
Old 01-20-2012, 12:37 PM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi scam,

Yes, changing /etc/profile file umask setting could be the reason. Setting the permission to 077 will make the files or directories to be created with the following permissions:

Directories:

Root: drwx------
User: ----------

Files:

Root: rwx------
User: ---------

In this scenario only root user will have access to those files and not the normal user if you have done the editing
 
Old 01-21-2012, 09:23 AM   #4
scam
Member
 
Registered: Jun 2011
Location: UK
Distribution: Slackware 13.1, Slackware 13.37
Posts: 92

Original Poster
Rep: Reputation: Disabled
Thanks for the replies slakmagik, T3RM1NVT0R. Would this have happened if only user had umask of 077 and root had 022. Is there a file i can edit which would give users default umask (of my choice) when created, without altering roots?

Thanks
 
Old 01-21-2012, 09:41 AM   #5
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Yes, you can make the changes in /etc/bashrc.

If you will do:

Code:
vi /etc/bashrc
and scroll down a bit you will find some lines which read as follows:

Code:
# By default, we want this to get set.
# Even for non-interactive, non-login shells.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi
Here there are two sections one for root user + service accounts and one for normal users. The first section which has umask 002 is for normal users. Any file created by them will have rw-rw-r-- permissions set by default. The second section for root and service account. So any file created by them will have rw-r--r-- permissions set by default.
 
Old 01-21-2012, 10:30 AM   #6
scam
Member
 
Registered: Jun 2011
Location: UK
Distribution: Slackware 13.1, Slackware 13.37
Posts: 92

Original Poster
Rep: Reputation: Disabled
Thanks again T3RM1NVT0R, is there not a file i can edit so on creation of a user it will be my choice of umask instead of editing ~/.bashrc? ... like login.defs or some file, without changing roots umask.
 
Old 01-21-2012, 02:11 PM   #7
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

You're welcome.

As far as I am aware /etc/bashr is the file where you can define the permissions that will be set on by default when a file/directory is created by the user.

/etc/login.defs file is helpful at the time of user creattion. If you define the UMASK value there then it will only for the creation of user's home directory at the time of useradd. This can also be achieved by using the following command:

Code:
useradd -K UMASK=umask_value_you_want <username>
If you set the UMASK value of 002 in the above command then the user's home directory will get created with the following rights:

drwxrwxr-x

If you want to specify file creation permission for all users you can define it in /etc/bashrc (This will be global and affect all users because /home/user/.bashrc points to /etc/bashrc). If you want it for specific users then you can do the following:

1. Copy the /etc/bashrc to /etc/myrc using the following command:

Code:
cp /etc/bashrc /etc/myrc
2. Edit the .bashrc file of that particular user to point to /etc/myrc as follows:
Code:
# .bashrc

# Source global definitions
if [ -f /etc/myrc ]; then
        . /etc/myrc
fi

# User specific aliases and functions
3. Edit /etc/myrc and edit the following section:

Code:
vi /etc/myrc
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 077
else
umask 022
fi

In this way you will not touch /etc/bashrc and you can always point the specific users to point to /etc/myrc files instead of /etc/bashrc by editing their /home/user/.bashrc file.
 
Old 01-21-2012, 04:10 PM   #8
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
/etc/bashrc is not a Slackware file though it can, of course, be created - it's not even a documented bash feature - and only affects bash users, of course. Also be careful using UID/GID checks from other distros. I'd personally recommend not messing with umask at all but, if you must, you can set it on a per user basis in personal shell configs or affect all users by modifying /etc/profile. You could also drop something in /etc/skel so it would affect all users created after that point, depending on their shell. And login.defs is another way - it's my understanding that it not only governs the creation of the home directory but also sets the default if not overridden by something else. There's a lot of ways to go - I'm sure yet more that haven't been mentioned.

Last edited by slakmagik; 01-21-2012 at 04:12 PM.
 
Old 01-22-2012, 10:04 AM   #9
scam
Member
 
Registered: Jun 2011
Location: UK
Distribution: Slackware 13.1, Slackware 13.37
Posts: 92

Original Poster
Rep: Reputation: Disabled
Yes, there seems alot of different ways to enforce umask on users, either at creation or when they login. Putting something in /etc/skel for umask when creating a user, and maybe /etc/bashrc when users login...but there are a quite a few choices, i'll to try them and other suggestions to see what suits me best. Thanks T3RM1NVTOR slakmagic
 
  


Reply



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
[SOLVED] Lack basic understanding of permissions(apache permissions problem) cK` Linux - Newbie 7 04-08-2010 11:49 PM
Permissions Problem? Ariod Linux - Software 2 08-16-2006 04:33 PM
old problem ... permissions devit Slackware 3 03-28-2004 04:50 PM
Sendmail problem: sm-client permissions problem d3funct Linux - Software 0 08-12-2003 05:00 PM
Permissions problem TheShemeta Linux - Newbie 10 06-12-2003 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

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