Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
So I changed my username form old.name to new.name but my home directory still reads old.name! Do I just rename it myself? *EDIT: I renamed it myself to new.name, now ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20

    trouble with changed username!


    So I changed my username form old.name to new.name but my home directory still reads old.name!

    Do I just rename it myself? *EDIT: I renamed it myself to new.name, now I cannot create a file test.txt in there! I'm using vi and it says

    "test.txt" E212: Can't open file for writing.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,387
    Did you modify only the username in /etc/{passwd,shadow,group} or also the uid?
    If it is only the username, then mv the old homedirectory name to the new one.
    And dont forget to change the homedirectory in /etc/passwd also.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20
    I changed the homedirectory in /etc/passwd also, but still same problem. It seems like I have no permissions to create files or save files anywhere! BUT, I have made myself an administrator by putting my username in the group Administrators and changing the sodoers file via visudo. What could be the problem?

    EDIT: I have to use sudo to create or change files! Do I have to?! How can I make it easier and not have to always type sudo when creating or changing a file?

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,387
    You should be able to write in your home directory, *unless* you have changed the uid.

    Please check the following and watch for typos:
    1) The new username is in
    - /etc/passwd
    - /etc/shadow
    - /etc/groups

    2) The new homedirectory is in
    - /etc/passwd
    - the /home directory

    btw: Administrator group doesnt help you that much.
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20
    everything seems fine, still cannot create files without sudo!

  6. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,387
    as your user:
    Code:
    grep your_username /etc/passwd
    ls -la ~ 
    touch ~/delete_me
    You must always face the curtain with a bow.

  7. #7
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20
    Quote Originally Posted by Irithori View Post
    as your user:
    Code:
    grep your_username /etc/passwd
    ls -la ~ 
    touch ~/delete_me
    Oh... when I ran "ls -la ~" I got a message:
    ls: cannot access /home/old.name: No such file or directory!

    Remember I changed the old.name to new.name! Why is it still looking for the old.name?

  8. #8
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,387
    Probably because $HOME is still set to the old name.
    A re-login should take care of that, however you need to be sure that all your modifications are correct.
    Otherwise you might not be able to login.

    btw, you did replace your_username with your username for the grep?
    The output line contains your home directory.
    ls -la on that home directory should then give some information.
    You must always face the curtain with a bow.

  9. #9
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20
    Quote Originally Posted by Irithori View Post
    Probably because $HOME is still set to the old name.
    A re-login should take care of that, however you need to be sure that all your modifications are correct.
    Otherwise you might not be able to login.

    btw, you did replace your_username with your username for the grep?
    The output line contains your home directory.
    ls -la on that home directory should then give some information.
    What do you mean? How do I replace my username with the one for grep?

  10. #10
    Just Joined!
    Join Date
    Jun 2012
    Posts
    20

    bad bash!

    When I log in instead of a nice bash prompt i get:

    bash-4.1$

    WTH?! How do I fix this?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •