Skip to main content
deleted 3 characters in body
Source Link
John1024
  • 76.4k
  • 12
  • 176
  • 165

Yes. The POSIX specification requires the shellOS to set a value for $HOME:

HOME
The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See pwd.h.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no true home, HOME is set to the root directory.

Yes. The POSIX specification requires the shell to set a value for $HOME:

HOME
The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See pwd.h.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no true home, HOME is set to the root directory.

Yes. The POSIX specification requires the OS to set a value for $HOME:

HOME
The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See pwd.h.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no true home, HOME is set to the root directory.

added 3 characters in body
Source Link
John1024
  • 76.4k
  • 12
  • 176
  • 165

Yes. The POSIX specification requiresrequires the shell to set a valueforvalue for $HOME:

HOME
The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See pwd.h.

The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See <pwd.h>.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no true home, HOME is set to the root directory.

Yes. The POSIX specification requires the shell to set a valuefor $HOME:

HOME

The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See <pwd.h>.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no home, HOME is set to the root directory.

Yes. The POSIX specification requires the shell to set a value for $HOME:

HOME
The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See pwd.h.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no true home, HOME is set to the root directory.

Source Link
John1024
  • 76.4k
  • 12
  • 176
  • 165

Yes. The POSIX specification requires the shell to set a valuefor $HOME:

HOME

The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See <pwd.h>.

What about user nobody?

# su - nobody
No directory, logging in with HOME=/
$ echo $HOME
/

Even though nobody has no home, HOME is set to the root directory.