Link to home
Start Free TrialLog in
Avatar of Craig Sharp
Craig SharpFlag for United States of America

asked on

Unix /etc/profile confirming existance of home directory

Simple question.  I need to confirm that a home directory exists when a user logs into Solaris and Linux boxes.  If no home, no access.  Ideas?  I was going to use the /etc/profile.  Any examples?
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We were trying to do similar when we converted from local accounts to LDAP.  But, be aware not all protocols use /etc/profile

If they (s)ftp into the box for example, it may not run /etc/profile
If they ssh with a command parm  (ssh {hostname} ls)  it may not run /etc/profile

Are you converting to LDAP?

Tom
Avatar of Craig Sharp

ASKER

Perfect, thanks!  I was in brain lock lol.
Tom,

I just saw your comments.  Thank you.  Yes we are converting to LDAP, but our only concern based on how our systems are setup is to prevent the developers to login to a command line.
The accepted solution as listed above is not secure, if your intention is to prevent a user from logging into the system if that person does not have a home directory. By the time the shell is executing and the /etc/profile script is being run, the tty stream is set up and accepting data from the controlling terminal. Is the terminal sends an interrupt signal, the execution will be interrupted and the user will be logged in anyway.

On Solaris, the right way to do this is to use a PAM module. Linux supports PAM as well, so it is probably the right thing on Linux as well.