i need to map some path like /data/test 123 as home directory for user testuser, but it is not accepting space in home directory path ?
it is not allowing me to change path using usermod -m -d /new path username
.
i need to map some path like /data/test 123 as home directory for user testuser, but it is not accepting space in home directory path ?
it is not allowing me to change path using usermod -m -d /new path username
.
You can do it using the -d
switch to useradd
useradd -d '/home/test 123' test123
Adding the single quotes '
also works for usermod but note that this will break all sorts of stuff that isn't expecting a space e.g.
su - test123
-bash: [: /home/test: binary operator expected
Similarly if you use something that isn't test e.g. tst 123
su - test123
-bash: [: /home/tst: binary operator expected
Save yourself a lot of pain and don't do that.
Or if you really need a home path with a space, create it as a link, i.e.
/data/test 123 > /data/test_123
That way, real work can be done with 'test_123', but you can make it look as 'test 123' when required?