So I watched Qain's video on a surveillance setup and I thought it might be a fun little project.
I downloaded the latest version of Debian and installed it on an old laptop I had lying around but when I tried to apt-get update I got a bunch of "Could not open lock file" and an "are you root?" messages so I tried sudo, got command not found. Had a quick look on google and people were saying sudo isn't installed if you give root user a password while installing the OS but I didn't give root a password, I left it blank.
How do you use su? I tried su apt-get update and got No password entry for user apt-get. Then tried with my username before apt-get and it said cannot execute binary file
su allows you to change what user you are working as. by default (with no user specified) it switches to root. This requires you to enter the root password when it asks.
This didnt work because su apt-get is you saying switch user to user apt-get which isnt a thing. sudo works that way because sudo gives temporary root privileges.
you can also do su username for example if you are logged in as root and want to do something as a non-root user you can use su distracted6 and it will switch to that user.
Ooooohh ok, that makes sense now. Now when I just use su on its own it asks for a password and then says authentication failure with and without a password
I dont know for Debian, but sudo normally needs setup in most distros. If you want to use sudo you can edit /etc/sudoers
The best way is to make it work only for users in a specific group, normal the wheel group.
You can check what groups your user has by running id if your not in the wheel group you can add it
su
gpasswd -a [user] wheel
replacing [user] with your username
then in the /etc/suders config the part youll want to look at is this. This specifies how sudo will work.
You'd make sure the second entry is uncommented.
##
## Runas alias specification
##
##
## User privilege specification
##
#root ALL=(ALL) ALL
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL