Skip to main content

Specify a home directory path for a user in /etc/passwd with spaces in it? [Resolved]

I have a path I want to use as a home directory in WSL, but it's also path that has spaces in it.

I've tried escaping the spaces with slashes, and I've tried using single and double quotes with just spaces in the file, but it sets me at the root directory, instead of my home directory, it seems I cannot specify a path with spaces in it within /etc/passwd.

Is there some other way to make this work?

Question Credit: leeand00
Question Reference
Asked September 19, 2019
Posted Under: Unix Linux
1 Answers

Simply use a space:

username:x:42:42:Jeff Schaller:/home/spaces here/username:/bin/bash

credit: Jeff Schaller
Answered September 19, 2019
Your Answer