issue with cd command on sudo


 
Thread Tools Search this Thread
Operating Systems AIX issue with cd command on sudo
# 1  
Old 12-19-2011
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
Code:
 cd

.
If i give
Code:
sudo cd /etc/security

it returns nothing.There is no
Code:
pwd

change and no any error messages.
[code]sudo -l [/sudo] command returns all executables including
Code:
cd

.

Code:
sudo ls /etc/security

works fine

Below is my sudoers file
Code:
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
# 2  
Old 12-19-2011
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.
# 3  
Old 12-19-2011
This might be what you are looking for:
Code:
sudo ksh -c "cd /etc/security; pwd ; ls -l"

# 4  
Old 12-19-2011
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
Code:
sudo cd /test

I dont understand why only
Code:
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
# 5  
Old 12-19-2011
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.
# 6  
Old 12-19-2011
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.
# 7  
Old 12-20-2011
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Sudo issue

Hello! I have this weird issue that started lately. I'm login as normal user lets call it "guy" and I type the command:sudo cat /etc/passwd what happens next is this reply in the command line: I'm not getting any prompt to enter password. (I don't have the "nopasswd" see the attachment image... (25 Replies)
Discussion started by: guy3145
25 Replies

2. Red Hat

Sudo access issue

Hi, I have given access to user mwadmin in shudders file as : mwadmin ALL:NOPASSWD:/www/* /usr/* /opt/* However, not able to execute below command: sudo mkdir -p /usr/test password for mwadmin: Sorry, user mwadmin is not allowed to execute '/bin/mkdir -p /usr/test' as root. ... (4 Replies)
Discussion started by: saurau
4 Replies

3. Linux

Sudo issue

Dear All, I wanted to execute sqlplus using another user instead of oracle user. I have given user AA sudo permissions in such a way that it can execute all oracle related files. when i try the below command from user AA ,it is not working. sudo -u oracle sh -c sqlplus Error 6... (1 Reply)
Discussion started by: jegaraman
1 Replies

4. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

5. UNIX for Dummies Questions & Answers

sudo login issue

I logged in through ssh, but can't re-login as root. sudo login Arch login: root Password: Login incorrect Arch login: But I am sure my password is right. Why? But on local tty1, this works. (2 Replies)
Discussion started by: vistastar
2 Replies

6. Shell Programming and Scripting

Issue in passing passwd to login into a sudo account

Hi Gurus, I have small issue... I used to pass the passwd for sudo commands like below, gzcat ~/passwd.gz | sudo su - <villin> >> eof ------ ----- ------ eof And it was able to login into "villin" sudo account successfully. But now, I'm using the same in another script for the... (2 Replies)
Discussion started by: raghu.iv85
2 Replies

7. UNIX for Dummies Questions & Answers

Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:"

Hi! I'm very new to unix, so please keep that in mind with the level of language used if you choose to help :D Thanks! When attempting to use sudo on and AIX machine with oslevel 5.1.0.0, I get the following error: exec(): 0509-036 Cannot load program sudo because of the following errors:... (1 Reply)
Discussion started by: Chloe123
1 Replies

8. UNIX for Advanced & Expert Users

Sudo command

Hello, What does the below sudo command provide access to, does it allow a user to su to any other user except root. sudo !/usr/bin/su * (1 Reply)
Discussion started by: sophos
1 Replies

9. Solaris

Sudo for a command

I am trying to set up sudo for a command, but do not want to specify the arguments that can be passed into it. I want the user who is using sudo to be able to pass in the arguments they want. I am fairly sure I know how to do this with RBAC in Solaris 10, but for reasons I will not get into I... (1 Reply)
Discussion started by: synchro
1 Replies

10. UNIX for Dummies Questions & Answers

Sudo permission issue

folks; How can i give a group a sudo permission to execute only some command "like start/stop Apache", so every user in that group can sudo to use this as himself, i mean when he tries to sudo, he will be asked for a password (and make it so he must use his own NT password not a generic one) then... (6 Replies)
Discussion started by: Katkota
6 Replies
Login or Register to Ask a Question