I am trying to build one script for my customization login from one user to another on multiple servers , for that i need to login from my user to another user on same server with out using sudo command for that I am using "echo "passward" | su - oracle " but it won't work, I am searching all forms they are suggesting sudo . but I don't want to use sudo. simple I looking switch user from my user to other on single command.
Asked
Active
Viewed 54 times
0
-
The easy way (if you have root access and can add yourself to the `wheel` group) is to edit `/etc/pam.d/su` and add/uncomment the following two lines `auth sufficient pam_wheel.so trust use_uid` and `auth required pam_wheel.so use_uid` which will then allow you so `su user` without a password. – David C. Rankin Jun 09 '17 at 08:16
-
no I am regular user, I have two accounts on my server one is my account and again switch back to install user awdmw – kirankumar.pedapudi Jun 09 '17 at 08:32
-
Understood, but if you have root access, you can add your normal user to `wheel` (or the `sudo` group if that is what your distro uses) and make the changes. Then you can switch from one user to any other. If you don't have `root` access to set it up, then you are kinda stuck. My concern with what you are doing is that I'm not sure that `su` will accept a password from `stdin`. I haven't messed with it, but piping a password to anything is a big security issue. – David C. Rankin Jun 09 '17 at 08:36
-
I want to passing a password on run time like variable, like (echo "$pass | su awdmw ) but its is not working when I am using in stdin also. – kirankumar.pedapudi Jun 10 '17 at 15:11
-
See: [**su pass password to script**](https://stackoverflow.com/questions/19164222/su-pass-password-to-script) – David C. Rankin Jun 10 '17 at 20:04