LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   what is a quick way to get all of files needed for adduser to put it on void linux? (https://www.linuxquestions.org/questions/slackware-14/what-is-a-quick-way-to-get-all-of-files-needed-for-adduser-to-put-it-on-void-linux-4175644309/)

BW-userx 12-14-2018 03:01 PM

what is a quick way to get all of files needed for adduser to put it on void linux?
 
I found this
https://github.com/shadow-maint/shad.../src/useradd.c
but I need the (personal) "headers" and o so I can compile it. maybe mod it a little first even. before installing it onto VOID Linux.

I know Slack got this and maybe it was Slack that came up with adduser over useradd. Anyways... anyone knows what address I got a pull from, or wget it?

I do not think that is even the right one now that I look at it. always getting the two confused. the short order form one. :D

ZhaoLin1457 12-14-2018 03:15 PM

The VOID Linux is not a Slackware derivative, so far I know. It was written from scratch, so what's the connection with Slackware?

Didier Spaier 12-14-2018 03:21 PM

Don't you know that this file belongs to the shadow software shipped in Slackware?
Have a look here:
http://slackware.uk/slackware/slackw...urce/a/shadow/
the url is indicated to get the whole archive: http://pkg-shadow.alioth.debian.org/releases/
Alternatively just clone the git repo:
git clone https://github.com/shadow-maint/shadow.git

But, why reinvent the wheel? All is there to package shadow for Void:
https://github.com/void-linux/void-p...hadow/template

PS: generally, if you look at a C program inside a software tree, chances are that the "personal" headers (those not listed between < >) are elsewhere in the same tree ;)

So just download the whole tree and at its root type:
find -name <header name>.

But that's assuming that for some reason you want to cherry pick a program to build just that, instead of building the whole software.

BW-userx 12-14-2018 03:35 PM

Quote:

Originally Posted by ZhaoLin1457 (Post 5937205)
The VOID Linux is not a Slackware derivative, so far I know. It was written from scratch, so what's the connection with Slackware?

debian has a version but there do not have what I'd call source code, it is gibberish to me what they have. and I think I got a copy of it on manjaro now that I think about it, and it was taken from slackware, I think it even mentions it, and when I used it, it is exacly like slackwares, because they did not even mod it to match there system. maybe I should go see if I can find what or where they down load it from.

I got 4 distros install so I jump around a lot and its hard to remember what I got where some times, for some things.

BW-userx 12-14-2018 03:38 PM

Quote:

Originally Posted by Didier Spaier (Post 5937207)
Don't you know that this file belongs to the shadow software shipped in Slackware?
Have a look here:
http://slackware.uk/slackware/slackw...urce/a/shadow/
the url is indicated to get the whole archive: http://pkg-shadow.alioth.debian.org/releases/
Alternatively just clone the git repo:
git clone https://github.com/shadow-maint/shadow.git

But, why reinvent the wheel? All is there to package shadow for Void:
https://github.com/void-linux/void-p...hadow/template

PS: generally, if you look at a C program inside a software tree, chances are that the "personal" headers (those not listed between < >) are elsewhere in the same tree ;)

So just download the whole tree and at its root type:
find -name <header name>.

But that's assuming that for some reason you want to cherry pick a program to build just that, instead of building the whole software.

I was query'ing for adduser let me check shadow ...

Code:

userx@voided.org:~
$ sudo xbps-query -Rs shadow
[ * ] shadow-4.6_1                    Shadow password file utilities
[-] shadowsocks-libev-3.2.3_1      Lightweight secured socks5 proxy for emb...
[-] shadowsocks-libev-devel-3.2.3_1 Lightweight secured socks5 proxy for emb...
userx@voided.org:~
$ vup shadow[*] Updating `https://alpha.de.repo.voidlinux.org/...86_64-repodata' ...
x86_64-repodata: 1696KB [avg rate: 2676KB/s][*] Updating `https://alpha.de.repo.voidlinux.org/...86_64-repodata' ...
Package 'shadow' is up to date.
userx@voided.org:~
$ sudo adduser
sudo: adduser: command not found

nope


-----------
Arch Linux swiped a copy from slackware
Quote:

Git Clone URL: https://aur.archlinux.org/adduser.git (read-only)
Package Base: adduser
Description: Interactive front end to /usr/bin/useradd from Slackware Linux
let me git clone that and try to get it to work.
it is just a build package script, time to play.

https://dfw.mirror.rackspace.com/sla...shadow/adduser

Didier Spaier 12-14-2018 03:53 PM

1 Attachment(s)
I don't know how Void packaging works, but for sure the build script I linked to installs useradd as I see in the postinstall() function:
Code:

    # Install our pam files not the ones supplied with shadow.
    rm -f ${DESTDIR}/etc/pam.d/*
    for f in chage passwd; do
        install -m644 ${FILESDIR}/${f}.pam ${DESTDIR}/etc/pam.d/${f}
    done
    for f in chpasswd chgpasswd groupadd groupdel groupmems \
        groupmod newusers useradd userdel usermod; do
        install -m644 $DESTDIR/etc/pam.d/chage $DESTDIR/etc/pam.d/${f}
    done
    install -m644 ${FILESDIR}/login.defs ${DESTDIR}/etc

So, just run this script to build a package and be happy.

I attach it to this post for your convenience.

Sorry I can't help you more.

Cheers,

bassmadrigal 12-14-2018 03:54 PM

adduser is just a script. It is available in the source directory of shadow.

Looking at the top of the file, it was originally developed for Slackware by Hrvoje Dogan back in 1995. Then in 2002, Stuart Winter, aka drmozes, took that script as the inspiration for the modern adduser script and it has been tweaked from there by both Stuart and Pat over the years to what it is now (with a changelog documenting those tweaks at the top of the script).

The script will eventually run the useradd binary from shadow to generate the account on the system and assign it the various settings, including groups.

BW-userx 12-14-2018 04:15 PM

Quote:

Originally Posted by bassmadrigal (Post 5937221)
adduser is just a script. It is available in the source directory of shadow.

Looking at the top of the file, it was originally developed for Slackware by Hrvoje Dogan back in 1995. Then in 2002, Stuart Winter, aka drmozes, took that script as the inspiration for the modern adduser script and it has been tweaked from there by both Stuart and Pat over the years to what it is now (with a changelog documenting those tweaks at the top of the script).

The script will eventually run the useradd binary from shadow to generate the account on the system and assign it the various settings, including groups.

yeah I see it is looks rather easy. I copied slackwares, and moded the defualt groups to add user to, and ran it not as root, in my home directory, of course it could not access
Code:

Creating new account...


Password:
useradd: cannot open /etc/passwd
useradd: failed to unlock /etc/passwd
- Error running useradd command -- account not created!
(cmd: /usr/sbin/useradd -d /home/bob -m  -g users -G audio,cdrom,floppy,input,lp,scanner,video -s /bin/bash bob)

but for arch linux pgkbuild and in voids that is for useradd not adduser it references a
Code:

package() {
  install -D -m755 adduser "${pkgdir}/usr/bin/adduser"
  sed '/^###/q;1,2d;s/^# *//' adduser | head -n -2 > LICENSE
  install -D LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

what is this LICENSE, and it has to be something to worry about getting right, and not just adding this script to sbin. yes?

Didier Spaier 12-14-2018 04:21 PM

Void uses PAM, not Slackware. For this reason you need to make adjustments.

BW-userx 12-14-2018 04:29 PM

Quote:

Originally Posted by Didier Spaier (Post 5937220)
I don't know how Void packaging works, but for sure the build script I linked to installs useradd as I see in the postinstall() function:
Code:

    # Install our pam files not the ones supplied with shadow.
    rm -f ${DESTDIR}/etc/pam.d/*
    for f in chage passwd; do
        install -m644 ${FILESDIR}/${f}.pam ${DESTDIR}/etc/pam.d/${f}
    done
    for f in chpasswd chgpasswd groupadd groupdel groupmems \
        groupmod newusers useradd userdel usermod; do
        install -m644 $DESTDIR/etc/pam.d/chage $DESTDIR/etc/pam.d/${f}
    done
    install -m644 ${FILESDIR}/login.defs ${DESTDIR}/etc

So, just run this script to build a package and be happy.

I attach it to this post for your convenience.

Sorry I can't help you more.

Cheers,

thanks for all of the pointing out stuff BUT this is for useradd which is not adduser, adduser uses useradd after it grathers information, making it a bit better to use. though I do wonder if I got add it to pam like void's script kist change the names for the program it is processing. because there is two different ones.

Code:

Manpage for useradd says: useradd is a low level utility for adding users. On Debian, administrators should
usually use adduser(8) instead. adduser : add user with full profile and info (pass, quota, permission, etc.)

two different ones, one uses the other one. the one VOID has it the other one, the backend one.

BW-userx 12-14-2018 04:31 PM

Quote:

Originally Posted by Didier Spaier (Post 5937227)
Void uses PAM, not Slackware. For this reason you need to make adjustments.

I am starting to figure that out. thanks! maybe hack VOID's build script for useradd. and use it for adduser.

what is worst case scenario if I screw this up?

bassmadrigal 12-14-2018 04:43 PM

Quote:

Originally Posted by BW-userx (Post 5937226)
but for arch linux pgkbuild and in voids that is for useradd not adduser it references a
Code:

package() {
  install -D -m755 adduser "${pkgdir}/usr/bin/adduser"
  sed '/^###/q;1,2d;s/^# *//' adduser | head -n -2 > LICENSE
  install -D LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

what is this LICENSE, and it has to be something to worry about getting right, and not just adding this script to sbin. yes?

The LICENSE file is created by the sed command above it, basically grabbing the top portion of the script and saving it as a license file.

Didier Spaier 12-14-2018 04:43 PM

Quote:

Originally Posted by BW-userx (Post 5937231)
I am starting to figure that out. thanks! maybe hack VOID's build script for useradd. and use it for adduser.

what is worst case scenario if I screw this up?

I really don't know. But (not requested advice, I know): considering that basically adduser is mostly a front-end for useradd, maybe your time would be better invested just getting acquainted with useradd and friends like usemod? It has a good man pages, with links to other utilities at the bottom.

BW-userx 12-14-2018 04:51 PM

Quote:

Originally Posted by Didier Spaier (Post 5937236)
I really don't know. But (not requested advice, I know): considering that basically adduser is mostly a front-end for useradd, maybe your time would be better invested just getting acquainted with useradd and friends like usemod? It has a good man pages, with links to other utilities at the bottom.

yeaaaahhhhh but I am sooo comfortable with slackware adduser. then having to remember useradd -g -m ... as adding users is not a daily task other then me when I am adding a user to mess around to try things out from time to time then delete same said user.
all of the other ones I do not have much issues with . moduser or is it usermod, and chown etc..

BW-userx 12-14-2018 05:00 PM

all this script does it gather information then calls useradd and hands it over to it.

Code:

# Add the account to the system
CMD="$useradd "$HME" -m "$EXP" "$U_ID" "$GID" "$AGID" "$SHL" "$LOGIN""
$CMD

I do think all I'd really have to do is add that script to sbin and volia done. maybe do that LICENSE thing, but the pam is already set up for useradd so that is taken care of.

Code:

userx@voided.org:~/Documents
$ sudo ./adduser

Login name for new user []: bob

User ID ('UID') [ defaults to next available ]:

Initial group [ users ]:
Additional UNIX groups:

Users can belong to additional UNIX groups on the system.
For local users using graphical desktop login managers such
as XDM/KDM, users may need to be members of additional groups
to access the full functionality of removable media devices.

* Security implications *
Please be aware that by adding users to additional groups may
potentially give access to the removable media of other users.

If you are creating a new user for remote shell access only,
users do not need to belong to any additional groups as standard,
so you may press ENTER at the next prompt.

Press ENTER to continue without adding any additional groups
Or press the UP arrow key to add/select/edit additional groups
:  audio cdrom floppy input lp scanner video wheel

Home directory [ /home/bob ]

Shell [ /bin/bash ]

Expiry date (YYYY-MM-DD) []:

New account will be created as follows:

---------------------------------------
Login name.......:  bob
UID..............:  [ Next available ]
Initial group....:  users
Additional groups:  audio,cdrom,floppy,input,lp,scanner,video,wheel
Home directory...:  /home/bob
Shell............:  /bin/bash
Expiry date......:  [ Never ]

This is it... if you want to bail out, hit Control-C.  Otherwise, press
ENTER to go ahead and make the account.


Creating new account...


Changing finger information for bob.
Name []: booy
Office []:
Office Phone []:
Home Phone []:


Finger information changed.
New password:
Retype new password:
passwd: password updated successfully


Account setup complete.


$ su bob
Password:
[bob@voided Documents]$ whoami
bob



All times are GMT -5. The time now is 05:16 AM.