Post here if you are a new Porteus member and you're looking for some help.
-
hope
- Black ninja
- Posts: 64
- Joined: 04 Jul 2020, 12:07
- Distribution: porteus 5.0rc1 KDE desktop
Post#1
by hope » 23 Feb 2021, 15:33
Hi,
I am trying to write a script file which use root priviliges such as changing files under root folder by script (usr/local/bin). However, although I used my commands in "sudo -s<<EOF ... EOF" block, script stops when it see sudo commands and ask root password. However Porteus's default root password" , since I did not change it, does not work in terminal window. It writes :
" We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
"
Where am i doing wrong? Why root password does not work?
My code is :
Code: Select all
#!/bin/sh
sudo -s <<EOF
cp -v unrar /usr/local/bin
EOF
Thanks.
Last edited by
hope on 23 Feb 2021, 17:10, edited 1 time in total.
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.
hope
-
Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#2
by Ed_P » 23 Feb 2021, 16:10
Not sure what the <<EOF does but for some sudo scripts I use:
echo toor | sudo -S command/options
Ed
Ed_P
-
hope
- Black ninja
- Posts: 64
- Joined: 04 Jul 2020, 12:07
- Distribution: porteus 5.0rc1 KDE desktop
Post#3
by hope » 23 Feb 2021, 16:58
Hi, I tried it now, but does not work for me.
The problem is eventhough I entered the root password "toor" to command line it does not work! After three attempt it says that "...3 incorrect attempt..." Does it restricted by some super invisible admin?
How can I disable it?
[Edit issue is SOLVED] :
I found
https://askubuntu.com/questions/1253643 ... inistrator. I supposed that it asks me root password, however, it asks my own password !
Thanks
.
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.
hope
-
beny
- Full of knowledge
- Posts: 2097
- Joined: 02 Jan 2011, 11:33
- Location: italy
Post#4
by beny » 23 Feb 2021, 17:24
hi you have to add guest to the sudoers configure if you want to use sudo but porteus or slackware use the su option su root password toor and you run your script.
beny
-
ncmprhnsbl
- DEV Team
- Posts: 3936
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
-
Contact:
Post#5
by ncmprhnsbl » 23 Feb 2021, 22:21
just FYI, from 5.0rc2 onwards the sudo password has been configured to ask for the target users password. ie the root password for root..
in any case, as beny says,
su works just as well in a script: su -c <command>
and it's best to change the root password to something more secure
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
ncmprhnsbl
-
hope
- Black ninja
- Posts: 64
- Joined: 04 Jul 2020, 12:07
- Distribution: porteus 5.0rc1 KDE desktop
Post#6
by hope » 24 Feb 2021, 09:10
ncmprhnsbl wrote: ↑23 Feb 2021, 22:21
just FYI, from 5.0rc2 onwards the sudo password has been configured to ask for the target users password. ie the root password for root..
in any case, as beny says,
su works just as well in a script: su -c <command>
and it's best to change the root password to something more secure
In the future Porteus, password should be "not for the caller but for the target" in sudo commands. Since I am new in Porteus, I am trying to get used to/ memorize such "patterns", and this announce break the routine. Thanks for great info!
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.
hope