How to find a user's home directory on linux or unix?

后端 未结 13 627
时光说笑
时光说笑 2020-12-23 19:57

How do I find the home directory of an arbitrary user from within Grails? On Linux it\'s often /home/user. However, on some OS\'s, like OpenSolaris for example, the path i

13条回答
  •  伪装坚强ぢ
    2020-12-23 20:12

    If you want to find a specific user's home directory, I don't believe you can do it directly.

    When I've needed to do this before from Java I had to write some JNI native code that wrapped the UNIX getpwXXX() family of calls.

提交回复
热议问题