Visit Our UNIX and Linux User Community

useradd w/o write permission on /etc/passwd

Thread Tools Search this Thread
Operating Systems Linux Red Hat useradd w/o write permission on /etc/passwd
# 1  
Old 01-25-2012
useradd w/o write permission on /etc/passwd

root user creates a user using the useradd command. This command creates an entry in the /etc/passwd file. /etc/passwd file has rw permission for the root user. Now, if I happen to remove the w permission for the root user, useradd command still is successfully creating entry in the /etc/passwd file. I understand there is nothing related to suid here.

Please advice how this works?
# 2  
Old 01-25-2012
simply put, root gets to break the rules.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 01-25-2012
/etc/passwd should have permissions 444 .
The "passwd" command has SUID permissions as root which is how users can update their password.
# 4  
Old 01-25-2012
Originally Posted by arran
i want to know why you want to take w permission from root?? root is your supper user and you will take back permission from root then which superuser can add user???
Originally Posted by Corona688
root gets to break the rules.
As long as it's not asking for something physically impossible, root can do it.
# as root
$ touch /tmp/asdf
$ chmod 000 /tmp/asdf
$ echo asdf > /tmp/asdf
$ cat /tmp/asdf
$ ls -l /tmp/asdf
---------- 1 root root 5 Jan 25 14:16 /tmp/asdf

Previous Thread | Next Thread
Test Your Knowledge in Computers #880
Difficulty: Medium
SCADA systems that tie together decentralized facilities such as power, oil, gas pipelines, water distribution and wastewater collection systems were designed to be open, robust, easily operated and repaired, and highly secure.
True or False?

10 More Discussions You Might Find Interesting

1. Red Hat

SE Linux write permission denied

Hi, In my server I am getting below errors in "/var/log/messages": Oct 8 14:45:44 LKOGOMEEMM01 kernel: type=1400 audit(1444295744.792:15818): avc: denied { write } for pid=53421 comm="ip" path="/var/VRTSvcs/log/tmp/IPMultiNIC-8" dev=dm-0 ino=2754879 scontext=system_u:system_r:ifconfig_t:s0... (4 Replies)
Discussion started by: rochitsharma
4 Replies

2. HP-UX

Sudo entry required to set permission similar to ROOT without using password (PASSWD) change optio

Hi All I had installed sudo in HP UX 11.3 and it is working fine but not able to make entry required to set permission similar to ROOT without using password (PASSWD) change option for define user in /etc/sudoers file Please help if some know the syntex? :confused::wall: (2 Replies)
Discussion started by: deviltech
2 Replies

3. HP-UX

Useradd and passwd in HP-UX

Dear All, I have Perl Script which previously running on solaris and now our system is moved to HP UX. The script is creating the users on unix and database. 1. When we are creating the new user, useradd keep newly created account in locked state 2. In script we were using Passwd... (5 Replies)
Discussion started by: yadavricky
5 Replies

4. UNIX for Dummies Questions & Answers

passwd - useradd issues

hi guys I'm having these problems with these commands and I have not idea why # passwd If 'passwd' is not a typo you can run the following command to lookup the package that contains the binary: command-not-found passwd -bash: passwd: command not found # useradd temp Warning:... (15 Replies)
Discussion started by: karlochacon
15 Replies

5. Shell Programming and Scripting

Help required to write shell script to change passwd

Hi All, I wanted to write a shell script which will change the expired passwd in oracle. Here is below what I am trying, #!/bin/sh set -x ORACLE_HOME="/optware/oracle/" SQLPLUS="${ORACLE_HOME}/bin/sqlplus" PASS="xyz" PATH=$ORACLE_HOME/bin:$PATH... (0 Replies)
Discussion started by: gr8_usk
0 Replies

6. Solaris

Solaris 8 passwd locked out − permission denied

Hi Gurus, i have ussers cannot change their passwords, neither can root change the user's password. O.S. Solaris 8 up−to−date on security patchaes as far as I know. Examples (names have been changed to protect the guilty): User logged on: $ passwd passwd: Changing password for <user>... (8 Replies)
Discussion started by: raziayub
8 Replies

7. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

8. UNIX for Dummies Questions & Answers

How the /etc/passwd file is written when user does not have permission

Hi, /etc/passwd file has write permission only for the root user. Now when a normal user changes the its own password using passwd command, how this information has been written to the /etc/passwd file when the user is not having write permission to this file. ~santosh (2 Replies)
Discussion started by: santosh149
2 Replies

9. Programming

Whant to write an entry in /etc/passwd (putpwent)

Hi i try to use the function putpwent to write a simple entry in "/etc/passwd" putpwnet returns 0 as it works but notething writes to /etc/passwd. What have i missed? My os -------- root@nighter-laptop:/home/nighter/labb# uname -a Linux nighter-laptop 2.6.22-14-generic #1 SMP Sun Oct 14... (5 Replies)
Discussion started by: nighter
5 Replies

10. AIX

I want to read username and lastupdate only from /etc/security/passwd and write the s

Hi All, As i asked you in my previous post, I want to read username and lastupdate only from /etc/security/passwd and write the same data to another file: The data in /etc/security/passwd will be in this form for example: smith: password = MGURSj.F056Dj lastupdate = 623078865 flags =... (0 Replies)
Discussion started by: me_haroon
0 Replies

Featured Tech Videos