:: Re: [DNG] How do I get the user's h…
Top Pagina
Delete this message
Reply to this message
Auteur: Riccardo Boninsegna
Datum:  
Aan: dng
Onderwerp: Re: [DNG] How do I get the user's home directory path?
On Sun, 11 Oct 2015 13:52:36 +0200
Edward Bartolo <edbarx@???> wrote:
> I need to get the unprivileged user home directory path. Does anyone know of a solution?


Can you pass the user's name or UID to the backend in some way?
If yes, this command could probably be adapted (credits: http://www.unix.com/unix-for-dummies-questions-and-answers/248183-extract-user-accounts-home-directory-etc-passwd.html) -- and I think there's actually a libc function for that!

`while IFS=: read user shadow uid guid geco home sh; do if [[ $uid -eq 1000 ]]; then echo $user $home; fi; done < /etc/passwd`


--
If you have received this e-mail by accident,
please bake it in the oven at 250 °C for 40 minutes
then let it cool down before frosting.