Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Monday, March 22, 2021

reset password and keyring pass phrase on fedora. Also change hostname


Fedora can have the password reset for root (when the logins are unknown) or access to root to reset the passwords if necessary with a mod to the grub entry that boots the system.

Break into the system (using grub entry edit)

https://docs.fedoraproject.org/en-US/quick-docs/reset-root-password/

  1. Use the arrow keys to select the boot entry you want to edit

  2. Press e to edit that entry

  3. Use the arrow keys to go to the line that starts with linux, linux16, or linuxefi

  4. Go the the end of that line, add a space then type rw init=/bin/bash. If your disk is encrypted, you may need to add plymouth.enable=0

  5. Press Ctrl-x or F10 to boot that entry

  6. Run the command:

    passwd

    It will prompt you to enter the new root password twice.

  7. Restore the SELinux context and permissions with:

    touch /.autorelabel
  8. Reboot the machine with:

    /sbin/reboot -f

I was fortunate to not only have a rescue mode boot entry (which still booted before the above procedure as normal) so didn't have to resort to the "Live Disk" procedure.  Refer to the link above for that procedure.

Once that is done, if auto login is set up, sometimes the pass phrase is locked for the keyring.  Some secret keys are stored in that structure, and it is protected before one can log in by a pass phrase.

 The Keyring may either be deleted (and subsequently have to reenter some previous logins), or if one can get to a gui there is a formula for resetting the passphrase for a users keyring.

https://www.linuxquestions.org/questions/ubuntu-63/any-way-to-change-the-gnome-keyring-password-410266/

root@debian:~# rm -r /home/USERDIR/.local/share/keyrings

 If the autologin is set, and you get stuck when your account automatically logs in, you get stuck at a page demanding the passphrase before your desktop can function.  Pretty much have to delete the key file and follow tat formula.

 Also need to change the hostname.

https://www.cyberciti.biz/faq/howto-change-hostname-in-fedora-linux-permanently/

show hostname

hostnamectl

change hostname

hostnamectl set-hostname new-name


--30--

Tuesday, November 27, 2018

change user name and home directory of linux user


Rename the user on linux.

This changes the login id and the home directory name.  It will not change any of the info in possible config files for shortcuts and packages which were embedded while configuring tools or programs on the account.

Things may have to be edited and replaced as needed manually.

https://websistent.com/change-home-directory-in-linux/

Change the home directory using usermod

This method is for command line warriors. Before you use the usermod command the new home directory should be created, ownership should be assigned to the new user and the folder should be chmoded correctly so that no one else can access it. Run the following commands to do it.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory
usermod --home /home/new_home_directory username

Change the home directory by editing /etc/passwd

Alternatively you can also edit the /etc/passwd to change the home directory. But you should be careful not to edit anything else. Before editing this file it is always better to create the new home directory and assign proper permissions and ownership to it. Execute the following commands.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory

Open the /etc/passwd file using a text editor and locate the line containing the required username it should look something like this
username:x:500:500::/home/username:/bin/bash

change it to
username:x:500:500::/home/new_home_directory:/bin/bash

Save the file.
Finally copy all the old content to the new home directory
cp -f /home/username/* /home/new_home_dir/

another link
https://askubuntu.com/questions/558669/renaming-user-name

--30--