I gather I missed a conversation last night about "sudo cd" being broken
on one of the boxes being played with (command not found).
For those confused by this, I'll start by saying that this is not
broken, then ask you to think about what "sudo cd" would mean if it did
work.
Suppose /root is a directory you're not allowed access to except as a
super user. Then
sudo /root/somecommand
.. would correctly run somecommand as the root user, and
sudo ls /root
.. would list files in /root. However
sudo cd /root
.. would fail.
In all cases you're asking sudo to run a command as root then return you
to the non-privileged user once complete. Running somecommand as root
makes sense, but if "cd" had worked then as soon as the command had
completed you'd be left as a non-privileged user in a directory you have
no rights to be in. Therefore cd in this context is meaningless, and
doesn't work.
It is doubtless true that the error message is misleading and unhelpful,
though.
In the rare occasions where this is a problem,
sudo bash
or
sudo su
.. will change your session to that of the root user, allowing you to cd
anywhere, and (of-course) to screw up your system in all sorts of ways
not possible when you were a non-privileged user.
A Google search for "sudo cd" will explain all this better.
--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0845 45 89 555
Registered in England (0456 0902) at 13 Clarke Rd, Milton Keynes, MK1 1LG
_______________________________________________
Peterboro mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/peterboro