Re: shell script how to switch users?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Thanks a lot for your quick responses.  After executing su - user2 -c
script . I am asked for password for user2. Is there any way through
we can we specify password too with this command.
- Rajiv

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list


As Mike suggests, you can use sudo.  Then with the option -S to
specify that the password will come from standard input instead of tty
(and then feed it using the < redirect), and the -u user2 to specify
to sudo to user2 instead of to root.  The security vulnerability being
that your password will have to come from somewhere (either within the
script or redirected from within a text file containing the password)
readable. Meaning someone who disects the script can figure out where
to go find the password (if it's not in the script).

There may be a way to do this a bit more securely, but I am not
certain.  I gather the script will run unattended, or will be run by
someone who should not know the password for user2?  If user1 is any
bit curious, he/she will be able to find out the password for user2
quite easily  by examing the script.  Unfortunately the script won't
run without r permission in addition to x permission (I tried with x
but no r and the script will not run).

Jacques B.

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux