issue with cd command on sudo

Hi admins,

I have installed sudo in aix 5.3 and configured sudoers file.Every command is working fine with sudo except

 cd 

.
If i give

sudo cd /etc/security

it returns nothing.There is no

pwd

change and no any error messages.

sudo -l [/sudo] command returns all executables including cd

.

sudo ls /etc/security

works fine

Below is my sudoers file

Cmnd_Alias      GENERAL = /usr/bin/cd, /usr/sbin/chfs, /usr/bin/sysdumpdev, /usr/sbin/bootinfo, \
                          /usr/bin/mksysb, /usr/sbin/backup, /usr/sbin/restore, /usr/bin/mt, \
                          /usr/bin/find, /usr/bin/ln, /usr/sbin/sar, /usr/bin/su, \
                          /usr/bin/chuser, /usr/bin/awk, /usr/bin/tar, /usr/bin/du, \
                          /usr/bin/sh, /usr/bin/cat, /usr/bin/more, /usr/bin/vi, \
                          /usr/bin/ls, /usr/bin/whereis, /usr/bin/ftp, /usr/bin/sftp, \
                          /usr/bin/scp, /usr/sbin/fsck, /usr/sbin/umount, /usr/sbin/mount, \
                          /usr/bin/lsvg, /usr/bin/lslv, /usr/bin/lspv, /usr/bin/fuser, /usr/bin/dsmadmc

Please let me know your suggestions.

Regards
newaix

---------- Post updated at 03:36 AM ---------- Previous update was at 03:33 AM ----------

I have tried with latest version and old version also .But issue persists.

Regards
newaix

Lats try different question what is your expected result ?

I do not see any reason why to use sudo cd.
Also you need to take in considerations that pwd also needs to have proper privileges to list your current location.

This might be what you are looking for:

sudo ksh -c "cd /etc/security; pwd ; ls -l"

Hi admins

Thanks for the response.

My goal is to give some of the root priviledges to my id and avoid using root account with daily operations.
I have configured sudo and commands confgiured in sudoers file works fine expect cd.
At any point of time during troubleshooting or daily operations, i may need to go to root folders or other user's folders
where my id does not have any permission.Here i can utilize sudo feature to go to certain folders with command

sudo cd /test

I dont understand why only

cd

is not working.

server is AIX 5.3

Regards
newaix

---------- Post updated at 05:45 AM ---------- Previous update was at 05:40 AM ----------

I have configured sudo in more than 10 servers.in all the 10 servers ,this problem persists.So i think some issue with sudo file.Please let me know the proper rpm for aix 5.3

cd is eventually a shell builtin. As already stated, that doesn't make sense to grant a user to run cd with sudo because as soon as sudo returns, the shell stays in the directory it was before sudo was run.

Imagine this: A separate process is created to run sudo. This separate process is happily granted permissions to run cd, and does so before quitting and leaving your original process where it is.

Hi Jlliagre,Corona688,

Thanks for the response.That was informative.

But please let me know , how i can cd into /etc/security folder, since the same is accessible for root account only.

Regards
newaix

For what reason? Simply being able to cd into a folder doesn't allow you to do anything that won't require further root access...

Technically,

sudo cd /etc/security

let you get in that directory for a small period of time. Should you want to do something there, see my reply in post #3