Quantcast
Channel: Is there a way to perform a full login as another user without being root? - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by Fiximan for Is there a way to perform a full login as another user without being root?

$
0
0

On a very simplistic base, you could replace the respective login-shell variable in /etc/passwd to a redirection script:

john_AD:x:1000:1000:,,,:/home/john_old:/sbin/redirect_user

And the script would be like

#!/bin/bash
#autoredirect user to old login
case $USER in
   jonh_AD) oldname=john_old
#add list of users
esac

su "$oldname"

Then make sure the AD_user can log into the old user without password, e.g. via a sudoers entry (adapt script to use sudo).


I however still suggest to create an "ID-update" script to be run once with the moving and have a less fiddly set-up in future. This is far more stable, secure and needs just as much effort as such script like above.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>