userdel -p option - FAQ/man page issue?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

userdel -p option - FAQ/man page issue?

Richard Toohey
Hi, guys.

I wanted to disable a user account under OpenBSD 4.9, and Google led me here:

http://www.openbsd.org/faq/faq10.html#AddDelUser

<quote>Removing users

To remove users with the user(8) hierarchy of commands, you will use
userdel(8). This is a very simple, yet usable command. To remove the user
created in the last example, simply:

# userdel -r testuser
Notice the -r option, which must be specified if you want the users home
directory to be deleted as well. Alternatively, you can specify -p and not -r
and this will lock the user's account, but not remove any
information.</unquote>

That last sentence - sounds exactly like what I need - so I try it:

# userdel -p testuser
usage: userdel -D [-p preserve-value]
      userdel [-prv] user

The man page suggests that it should work as well.

Looks like it has been raised before:

http://www.mail-archive.com/bugs@.../msg01370.html

No patches because I'm not exactly sure what the "right" answer(s) are.

Am I just doing it wrong?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: userdel -p option - FAQ/man page issue?

Tomas Bodzar-4
On Thu, Sep 15, 2011 at 11:28 AM, Richard Toohey
<[hidden email]> wrote:
> Hi, guys.
>
> I wanted to disable a user account under OpenBSD 4.9, and Google led me
here:

>
> http://www.openbsd.org/faq/faq10.html#AddDelUser
>
> <quote>Removing users
>
> To remove users with the user(8) hierarchy of commands, you will use
> userdel(8). This is a very simple, yet usable command. To remove the user
> created in the last example, simply:
>
> # userdel -r testuser
> Notice the -r option, which must be specified if you want the users home
> directory to be deleted as well. Alternatively, you can specify -p and not
-r

> and this will lock the user's account, but not remove any
> information.</unquote>
>
> That last sentence - sounds exactly like what I need - so I try it:
>
> # userdel -p testuser
> usage: userdel -D [-p preserve-value]
> B  B  B userdel [-prv] user
>
> The man page suggests that it should work as well.
>
> Looks like it has been raised before:
>
> http://www.mail-archive.com/bugs@.../msg01370.html
>
> No patches because I'm not exactly sure what the "right" answer(s) are.
>
> Am I just doing it wrong?

$ id test
uid=1001(test) gid=1001(test) groups=1001(test)
$ sudo userdel -pv test
$ id test
id: test: No such user
$ grep test /etc/passwd
$ ls -ld /home/test
drwxr-xr-x  3 1001  test  512 Sep 15 11:52 /home/test
$
$ sudo chsh test
chsh: unknown user: test
$
$ sudo userdel -pv test
userdel: No such user `test'
$


I'm on current. Anyway strange that -v switch doesn't provide verbose
output in fact and that information in password file was not preserved
in fact. User disappeared somewhere, but where :-) Files are in place
as you can see.



>
> Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: userdel -p option - FAQ/man page issue?

Tomas Bodzar-4
On Thu, Sep 15, 2011 at 11:57 AM, Tomas Bodzar <[hidden email]>
wrote:
> On Thu, Sep 15, 2011 at 11:28 AM, Richard Toohey
> <[hidden email]> wrote:
>> Hi, guys.
>>
>> I wanted to disable a user account under OpenBSD 4.9, and Google led me
here:

>>
>> http://www.openbsd.org/faq/faq10.html#AddDelUser
>>
>> <quote>Removing users
>>
>> To remove users with the user(8) hierarchy of commands, you will use
>> userdel(8). This is a very simple, yet usable command. To remove the user
>> created in the last example, simply:
>>
>> # userdel -r testuser
>> Notice the -r option, which must be specified if you want the users home
>> directory to be deleted as well. Alternatively, you can specify -p and not
-r

>> and this will lock the user's account, but not remove any
>> information.</unquote>
>>
>> That last sentence - sounds exactly like what I need - so I try it:
>>
>> # userdel -p testuser
>> usage: userdel -D [-p preserve-value]
>> B  B  B userdel [-prv] user
>>
>> The man page suggests that it should work as well.
>>
>> Looks like it has been raised before:
>>
>> http://www.mail-archive.com/bugs@.../msg01370.html
>>
>> No patches because I'm not exactly sure what the "right" answer(s) are.
>>
>> Am I just doing it wrong?
>
> $ id test
> uid=1001(test) gid=1001(test) groups=1001(test)
> $ sudo userdel -pv test
> $ id test
> id: test: No such user
> $ grep test /etc/passwd
> $ ls -ld /home/test
> drwxr-xr-x B 3 1001 B test B 512 Sep 15 11:52 /home/test
> $
> $ sudo chsh test
> chsh: unknown user: test
> $
> $ sudo userdel -pv test
> userdel: No such user `test'
> $
>
>
> I'm on current. Anyway strange that -v switch doesn't provide verbose
> output in fact and that information in password file was not preserved
> in fact. User disappeared somewhere, but where :-) Files are in place
> as you can see.



>$ sudo rm -rf /home/test/
$ userdel -D
preserve        false
$ userdel -p true
usage: userdel -D [-p preserve-value]
       userdel [-prv] user
$ userdel -p yes
usage: userdel -D [-p preserve-value]
       userdel [-prv] user
$ userdel -p 1
usage: userdel -D [-p preserve-value]
       userdel [-prv] user
$ vi /etc/usermgmt.conf
$ sudo vi /etc/usermgmt.conf
$ userdel -D
preserve        true
$ useradd -c 'Testing user' -m test
useradd: Program must be run as root
$ sudo useradd -c 'Testing user' -m test
$ id test
uid=1001(test) gid=10(users) groups=10(users)
$
$ grep test /etc/passwd
test:*:1001:10:Testing user:/home/test:/bin/ksh
$ ls -ld /home/test
drwxr-xr-x  3 test  users  512 Sep 12 09:53 /home/test
$ sudo userdel -pv test
$ grep test /etc/passwd
$ id test
id: test: No such user
$ ls -ld /home/test
drwxr-xr-x  3 1001  users  512 Sep 12 09:53 /home/test
$

Looks like userdel -p in its first form doesn't work because you need
to set preserve in /etc/usermgmt.conf file to get it in true state and
even after that login informations are not preserved, just home
directory. So something is maybe really wrong?

>
>>
>> Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: userdel -p option - FAQ/man page issue?

William Boshuck
On Thu, Sep 15, 2011 at 12:05:55PM +0200, Tomas Bodzar wrote:

> On Thu, Sep 15, 2011 at 11:57 AM, Tomas Bodzar <[hidden email]>
> wrote:
> > On Thu, Sep 15, 2011 at 11:28 AM, Richard Toohey
> > <[hidden email]> wrote:
> >> That last sentence - sounds exactly like what I need - so I try it:
> >>
> >> # userdel -p testuser
> >> usage: userdel -D [-p preserve-value]
> >> B  B  B userdel [-prv] user
> >>
> > I'm on current. Anyway strange that -v switch doesn't provide verbose
> > output in fact and that information in password file was not preserved
> > in fact. User disappeared somewhere, but where :-) Files are in place
> > as you can see.
>
>
>
> >$ sudo rm -rf /home/test/
> $ userdel -D
> preserve        false
> $ userdel -p true
> usage: userdel -D [-p preserve-value]
>        userdel [-prv] user

This should be 'userdel -D -p true'
according to userdel(8).

'userdel -p true user' also works
if preserve has not been set to
true (one way or another), which
is perhaps not obvious from the
syopsis.

Reply | Threaded
Open this post in threaded view
|

Re: userdel -p option - FAQ/man page issue?

Richard Toohey
Quoting William Boshuck <[hidden email]>:

> On Thu, Sep 15, 2011 at 12:05:55PM +0200, Tomas Bodzar wrote:
> > On Thu, Sep 15, 2011 at 11:57 AM, Tomas Bodzar
> <[hidden email]>
> > wrote:
> > > On Thu, Sep 15, 2011 at 11:28 AM, Richard Toohey
> > > <[hidden email]> wrote:
> > >> That last sentence - sounds exactly like what I need - so I try
> it:
> > >>
> > >> # userdel -p testuser
> > >> usage: userdel -D [-p preserve-value]
> > >> B B B userdel [-prv] user
> > >>
> > > I'm on current. Anyway strange that -v switch doesn't provide
> verbose
> > > output in fact and that information in password file was not
> preserved
> > > in fact. User disappeared somewhere, but where :-) Files are in
> place
> > > as you can see.
> >
> >
> >
> > >$ sudo rm -rf /home/test/
> > $ userdel -D
> > preserve false
> > $ userdel -p true
> > usage: userdel -D [-p preserve-value]
> > userdel [-prv] user
>
> This should be 'userdel -D -p true'
> according to userdel(8).
>

I don't mean it rudely, but where do you see that in userdel(8)?

USERDEL(8)              OpenBSD System Manager's Manual             USERDEL(8)

NAME
     userdel - remove a user from the system

SYNOPSIS
     userdel -D [-p preserve-value]
     userdel [-prv] user

The second form suggests that I should be able to do ...

userdel -p user

... doesn't it?  (And that is also what the I think the FAQ is telling me.)

Thanks.

> 'userdel -p true user' also works
> if preserve has not been set to
> true (one way or another), which
> is perhaps not obvious from the
> syopsis.