sudo script
I created a script as root to remove some symlinks and to copy some files instead of them.
The problem is that I am not able to run the script as root.
As user knoppix I am able to run the script, but do not have the rights to remove the symlinks.
I want to save the script on the harddisk, so it will be there all the time.
As soon as I save it on harddisk the ownership seems to change to knoppix:knoppix
I tried as root:
ownership did not change.Code:chown knoppix:knoppix filename
I tried as root:
chmod u+x filename
and
chmod +x filename
root could still not run the script, while knoppix can, but does not have enough rights.
What can I do about this?
Another question is: how do I get the answer on the question if knoppix should remove the symlink answered with yes without human interferance.
sudo script
I think you should issue aOriginally Posted by Hermanh
or try (as root):Code:chown root:root filename
tomCode:# chmod 777 filename
Thanks for those answers. I tried them both.
When I do as root:
I still can not run the scriptCode:chmod 777 filename
When I do as root:
I get:Code:chown root:root filename
AlsoCode:chown: changing ownership of 'filename': operation not permitteddoes not work as root or as knoppix.Code:sudo filename
I've started knoppix with the cheatcode knoppix 2 to stay in textmode.
After the script has run the knoppix-box will function as ftp-server.
maybe put
sudo su
at the top of the script
or put
sudo rm / sudo ln etc
what kind of script? and you are running ./script.sh ?
what happens with
sudo ./script.sh ?
When I do as root:
the onwnership of the new file is root:root.Code:cp /mnt/hda1/filename /etc/filename
Still I can not run the script as root, not even when I do as root:
orCode:chmod u+x filename
orCode:chmod +x filename
Which should work according to several Linux howto's.Code:chmod 777 filename
I get a message:
The file existsCode:bash: filename: command not found
When I do:
I getCode:ls -l filename
('filename' is colored green)Code:-rwxrwxrwx 1 root root 549 jan 26 15:25 filename
Is user knoppix using another shell or something like that?
you have to do
not justCode:./filename
Code:filename
thanks, the script is running.
did do it. I did not expect that because it runned as knoppix using justCode:./filename
Code:filenameHas one of you also the answer for the second part of my question?Another question is: how do I get the answer on the question if knoppix should remove the symlink answered with yes without human interferance.
you meanAnother question is: how do I get the answer on the question if knoppix should remove the symlink answered with yes without human interferance.
rm -f ?
I'm going from memory, but I saw a post either on this forum or on the linuxtag knoppix forum about a user that could not run scripts. IIRC he had to:
/bin/bash script
rock

Intel Xeon E5-2699 V4 2.20GHz 55M 22-CORES LGA2011-3 Server Processor 145W SR2JS
$84.49
Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram 2x 550W PSU No HDD
$275.00
Dell Precision T5820 950W Workstation 4.00GHz W-2125 No RAM/ GPU/ HDD/ OS
$144.98
Intel(R) Xeon(R) CPU @ 3.30GHz, 4 Core(s), 32 GB RAM, 1 GB HDD Workstation 3
$145.00
HP Z8 G4 Z8G4 Barebone Workstation w/ Intel Xeon Silver - No HDD No RAM No GPU
$449.99
Lenovo ThinkStation P520 Intel Xeon W-2123 3.6GHz 900W - NO RAM/ GPU/ HDD/ OS
$189.98
Matched Pair _ Intel Xeon E5-2698 V4 2.2GHz 20-Core Processor CPU LGA2011 SR2JW
$94.99
Intel Xeon Gold 6230 2.1 GHz Processor - SRF8W
$29.00
Supermicro 1027GR-TSF 1U Rackmount Server 2x Xeon 2.3GHz 128GB DDR3
$219.99
Intel Xeon Processor E5-2687W V4 SR2NA 3.00GHz Broadwell 160W LGA2011 12-Core
$36.00