This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 170572 - useradd does not add /etc/skel dotfiles in some situations
useradd does not add /etc/skel dotfiles in some situations
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: shadow-utils (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-12 18:33 EDT by Dan Hollis
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-19 10:26:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Dan Hollis 2005-10-12 18:33:00 EDT
Description of problem:
in some situations (scripted from cgi), useradd does not seem copy dotfiles from
/etc/skel, but all other files get copied fine (eg directories). however when
called from interactive shell from commandline, all files including dotfiles are
copied just fine.

Version-Release number of selected component (if applicable):
shadow-utils 4.0.3

How reproducible:
always

Steps to Reproduce:
1.script adduser from cgi
2.run cgi
3.
  
Actual results:
everything _except_ dotfiles are copied successfully from /etc/skel

Expected results:
everything including dotfiles should be copied.

Additional info:
called from cgi as:
/usr/sbin/useradd -d /home2/bla -u <someuserid> -g 5000 -m -s /bin/true username

when called from cgi, only non-dotfiles are copied from skel. when called from
interactive ssh, everything works as expected.
Comment 1 Peter Vrabec 2005-10-13 10:51:51 EDT
What do u mean by cgi? cgi script run by apache?

note there is shadow-utils-4.0.12-5.FC4 in fc4
(yum update)
Comment 2 Dan Hollis 2005-10-13 16:12:24 EDT
yes, useradd run from a apache cgi script.

my mistake, this is FC3.
Comment 3 Peter Vrabec 2005-10-14 05:38:26 EDT
Could u reproduce the problem with shadow-utils from devel or FC4?
Comment 4 Dan Hollis 2005-10-18 20:34:17 EDT
is it safe to use shadow-utils from FC4 on FC3?
Comment 5 Peter Vrabec 2005-10-19 05:49:50 EDT
There are some conflicts between FC3 and shadow-utils from FC4, but it should
work when u install it with "--force" option.

I still don't understand one thing. Under which user your cgi script run? It
should be apache by default,but user apache is not allowed to add users.

My cgi(FC4):
  echo `id`
  echo `/usr/sbin/useradd foo 2>&1`
returns:
  uid=48(apache) gid=48(apache) groups=48(apache)   
context=root:system_r:httpd_sys_script_t
  useradd: unable to lock password file
Comment 6 Dan Hollis 2005-10-19 05:51:05 EDT
it's run via sudo
Comment 7 Peter Vrabec 2005-10-19 10:26:08 EDT
It works for me.
shadow-utils-4.0.12-5.FC4

# ls -aR /etc/skel/
/etc/skel/:
.  ..  a  .bash_logout  .bash_profile  .bashrc  .gtkrc  .kde  xxx  .zshrc

/etc/skel/a:
.  ..  xxx

/etc/skel/.kde:
.  ..  Autostart

/etc/skel/.kde/Autostart:
.  ..  .directory

# cat skript
#!/bin/bash
echo "Content-type: text/html\n\n"
echo
echo "Hello,World."
echo `id`
echo `sudo useradd -d /home/foo -u 666 -g 500 -m -s /bin/true foo`

# cat /etc/sudoers
...
apache  ALL=(ALL)       NOPASSWD: ALL
...

# ls -aR /home/foo
/home/foo:
.  ..  a  .bash_logout  .bash_profile  .bashrc  .gtkrc  .kde  xxx  .zshrc

/home/foo/a:
.  ..  xxx

/home/foo/.kde:
.  ..  Autostart

/home/foo/.kde/Autostart:
.  ..  .directory

Note You need to log in before you can comment on or make changes to this bug.