-
[quote="Hermanh"]thanks, the script is running.
did do it. I did not expect that because it runned as knoppix using just
Knoppix user must have pwd in the PATH. Its a really bad idea to do this with root accounts though from a security perspective. I have managed to elevate privilege on a number of *nix boxes (whilst doing authorised pen tests I hasten to add) through this technique. Root has pwd in his path and /tmp is world writable. Stick a script called ls in there and then give him cause to go looking in tmp (fill up disk by stuffing directory full of crap). Poor sap follows standard sysadmin technique and navigates into the directory and runs ls [-alSr] which runs the dropped in script. This usually does something like echo a standard add user line into the /etc/password file and then run the real ls command.
-
Senior Member
registered user
--Yep, that's pretty much the situation in a nutshell. 
--BTW, "pwd" is the current working directory. If you issue:
' pwd ' in bash, it will tell you where you are. Same as:
' echo $PWD ' == Which is the environment variable.
--If you have "pwd" (actually :$PWD
in your $PATH, it tells bash to look in your current directory for executable files... NOT something you want to do as Root, for the aforementioned reasons. Hard-core *nix purists don't have a $PATH *at all* in root; they issue ' /sbin/ifconfig ' and stuff like that so it ALWAYS gets executed from the right directory. (' man whereis ')
[quote="Flibble"]

Originally Posted by
Hermanh
thanks, the script is running.
did do it. I did not expect that because it runned as knoppix using just
Knoppix user must have pwd in the PATH. Its a really bad idea to do this with root accounts though from a security perspective. I have managed to elevate privilege on a number of *nix boxes (whilst doing authorised pen tests I hasten to add) through this technique. Root has pwd in his path and /tmp is world writable. Stick a script called ls in there and then give him cause to go looking in tmp (fill up disk by stuffing directory full of crap). Poor sap follows standard sysadmin technique and navigates into the directory and runs ls [-alSr] which runs the dropped in script. This usually does something like echo a standard add user line into the /etc/password file and then run the real ls command.
-
Thanks for your reactions everybody.
I will not change the PATH.
I found out that my second question

Originally Posted by
Hermanh
How do I get the answer on the question if knoppix should remove the symlink answered with yes without human interferance.
is solved also, because the script does not halt for an answer, while removing sym-links. I expected it would.
-
Senior Member
registered user
--The reason ' rm ' usually halts, as root:
Code:
' alias rm ' == Answers:
alias rm='rm -i'
--See ' man rm ' for more details. Similarly, if you call the exec directly, such as ' /bin/ls ' or ' /bin/rm ' it will also override the alias. I think the reason the script does not wait for your response at the rm, is because the rm alias has not been defined yet at that point in the boot process.

Originally Posted by
Anonymous
Thanks for your reactions everybody.

I will not change the PATH.

I found out that my second question

Originally Posted by
Hermanh
How do I get the answer on the question if knoppix should remove the symlink answered with yes without human interferance.
is solved also, because the script does not halt for an answer, while removing sym-links. I expected it would.
-
Well I think it has notthing to do with that because I start the script manually after the boot-process is finished. But still it works fine for me.
I will look into the man rm, I did not do that yet.
(There are a lot man's (to much) I did not look into yet).
-
[quote="Hermanh"]Well I think it has notthing to do with that because I start the script manually after the boot-process is finished. But still it works fine for me.
The reason "rm" does not ask for confirmation is, that aliases have to be defined for every new instance of a shell you run. If you run your script, it gets run in its own subshell where the aliases are not defined. So "rm" is really "rm" not "rm -i"!
You can put the alias definitions in the shell rc file (~/.bahrc for bash) to enable them for every shell.
-
Thanks for the answer I'll try that once just for fun.
Similar Threads
-
Replies: 5
Last Post: 01-06-2005, 02:29 AM
-
By mzilikazi in forum General Support
Replies: 0
Last Post: 07-28-2004, 08:36 PM
-
By A. Jorge Garcia in forum Hdd Install / Debian / Apt
Replies: 3
Last Post: 07-03-2004, 06:22 PM
-
By fabriloup in forum General Support
Replies: 1
Last Post: 09-13-2003, 10:28 AM
-
By Dave_Bechtel in forum General Support
Replies: 0
Last Post: 06-04-2003, 11:54 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

IBM Power 9 Linux L922, 2x6-Core CPU / No RAM / 2 x 1400W PSU / Rails - 9008-22L
$607.44

1U Open Source Router Firewall X10SLH-N6-ST031 E3-1240 V3 6x 10GB Ethernet 16GB
$350.00

Proxmox Linux VM VPS Xeon Server /w 512GB RAM 28TB HDD for Virtual Machine Cloud
$1647.00

1U Open Source Router Firewall 6x 10GB Ethernet X10SLH-N6-ST031 E3-1240 V3 32GB
$429.00

Toshiba Magnia SG20 VPN Linux server Web server (No HDD, *Read*) -
$60.00

Ubuntu Server 26.04.1 LTS Bootable USB Flash Drive – Latest September 2026
$15.46

Linux Mint AI Deep Learning PC Workstation Ryzen 5 24gb Ram 16gb Tesla P100 GPU
$599.99

Microsoft SQL Server 2025 Standard 48 Core Unlimited User CALs CoA Authentic
$298.88

Microsoft SQL Server 2025 Standard 32 Core Unlimited User CALs CoA Authentic
$388.00

Buffalo BRXL-PUS6U3B, 4K UHD, firmware Flashed, Unlocked, LibreDrive, MakeMKV
$249.99