0

I was trying to make a script to set up a sudo user . Copy pasting one by one Debian commands work , but not running in script .

Debian9=$(lsb_release -a 2>/dev/null | grep '^Description' | awk '{print $2}')
if [[ $Debian9 == Debian ]] ; then
    su root
    SU_user=$(stat -c '%U' ./)
    adduser "$SU_user" sudo
else
    other_distro_sudo_user_setup
fi
continue_script

line 5: adduser: command not found

Not really necessary but I'm wondering if this can be done somehow ?

p.la
  • 23
  • 5
  • I really doubt this line (`su root`) is doing what you think it is. That doesn't make following commands in the script run with root privileges. BTW, are you re-inventing the wheel here? Sure looks like you are trying to do something that would be better handled by one of the many configuration management tools (ansible/puppet/chef/etc). – Zoredache Jun 07 '18 at 18:39
  • Logging to root account for being able to grant current working directory user sudo priviledge ? Not needed , just curios . I'll have a look at some management tools . – p.la Jun 07 '18 at 19:14

0 Answers0