| emdete | fsmithred: the 5th field in /etc/passwd - wasnt the name "gecoes" or something...? | 09:42 |
|---|---|---|
| emdete | ah, mason already answered that one ;) | 09:43 |
| emdete | fsmithred: the old setting is used to overwrite it with a new setting without considering the username at all. i would suggest to just overwrite the 5th field of the new username | 09:50 |
| onefang | That field is entirely useful stuff like room number, real name, phone number, etc. | 10:02 |
| fsmithred | emdete, can you paste the line of code you are talking about? This is not handled the same way in change-username and refractainstaller. I think the former needs to catch up. | 13:50 |
| fsmithred | installer has the following in it: | 13:52 |
| fsmithred | #sed -i~ "s/$old_realname,,,/$new_realname,,,/" /target/etc/passwd | 13:52 |
| fsmithred | chroot /target /bin/bash -c "chfn -f '$new_realname' $newname" | 13:52 |
| fsmithred | I haven't figured out what to do about the filenames with spaces. Tried a few different ways to quote, but none worked. | 13:55 |
| emdete | fsmithred: yes, that `sed -i~ "s/$old_realname..` is the line in question, will check for an alternative, give me a minute | 16:06 |
| fsmithred | emdete, I think chfn is the right way to do it. | 16:15 |
| emdete | `awk < /etc/passwd -F : -v username=root -v gecoe=Rob\ Ott,,, 'BEGIN{OFS=":";}$1==username{$5=gecoe}{print $0}'` | 16:15 |
| emdete | ah, you are right - there is a prgram for that already! | 16:15 |
| fsmithred | what does that do? | 16:15 |
| fsmithred | does that awk do something with the other fields if they are full? | 16:16 |
| emdete | replaces the 5th element in a line of the user (in that case user root gets gecoe Rob Ott) | 16:16 |
| emdete | it overwrites the 5th but locates by username, not by the old gecoe | 16:16 |
| emdete | no, it doesnt | 16:17 |
| fsmithred | don't worry about it | 16:17 |
| emdete | but you are right chfn is the way to go ;) | 16:17 |
| fsmithred | the other thing I know I should change - when someone selects sudo as default, root password gets removed, but the shell doesn't get changed. | 16:18 |
| emdete | probably there is a awk in that thingie | 16:18 |
| emdete | passwords are in shadow, the second field is unused or am i wrong? | 16:19 |
| fsmithred | yeah, in shadow. Not sure which field without looking. | 16:19 |
| emdete | what do you mean with "selects sudo as default"? | 16:21 |
| emdete | (its' always my first action to remove sudo, dont know much about it) | 16:21 |
| fsmithred | the installer gives four choices: keep root account and nobody gets sudo | 16:22 |
| fsmithred | use sudo and disable root account | 16:22 |
| fsmithred | ^^^ that's the one I was talking about | 16:22 |
| fsmithred | use sudo and keep root account | 16:23 |
| emdete | ah, ok. | 16:23 |
| fsmithred | use sudo for shutdown and keep root account | 16:23 |
| fsmithred | that last one is my favorite | 16:23 |
| fsmithred | sudo nopasswd for shutdown/reboot | 16:23 |
| emdete | ok, sounds reasonable (i would add pm-suspend) | 16:24 |
| fsmithred | so yeah, it's the second field in /etc/shadow | 16:24 |
| fsmithred | yeah, suspend is included, pretty sure. | 16:24 |
| fsmithred | my own rig has several others added to the list. | 16:24 |
| emdete | i prefere working with su - i use a very old installer and changed it to be unattended (remember?), so i dont have that code. how is that done, as far as i remember there are tools as well to play with the shell und passwords, right? | 16:27 |
| fsmithred | chsh -s /sbin/nologin root | 16:30 |
| emdete | and that doesnt work? | 16:31 |
| fsmithred | There's chpasswd which works in batch mode | 16:31 |
| fsmithred | I assume chsh works. It's not in the script (yet). | 16:31 |
| emdete | ah, ok :) | 16:31 |
| emdete | give me some time, i will check for the quoting of the filenames... | 16:32 |
| fsmithred | it's a 10-year-old script that has had features stuck onto it that entire time | 16:32 |
| fsmithred | I can get awk to spit out the list of filenames with quotes, but then sed chokes on it. | 16:33 |
| fsmithred | and the sed command is already using double quotes for the variables | 16:34 |
| fsmithred | oh, the filenames aren't part of the substitution. | 16:35 |
| yeti | plural? filenames from find? | 16:38 |
| yeti | maybe xargs -0 can help? | 16:39 |
| fsmithred | no, it's a for loop | 16:40 |
| yeti | :-( | 16:40 |
| fsmithred | looking inside files in .config and .local for files that contain /home/username | 16:40 |
| fsmithred | to change old username to new one | 16:41 |
| fsmithred | I'm guessing there's not a cool linux command to do that | 16:41 |
| fsmithred | hm | 16:42 |
| fsmithred | maybe find is the way to go | 16:42 |
| yeti | reminds me of BS we did in BASIC days by adding cursor movement into the lines so that listing the program could do funny things | 16:44 |
| parazyd | fsmithred: Try `grep -rl '/home/username' /home/username/.config /home/username/.local | 16:44 |
| yeti | filenames even might contain newlines | 16:45 |
| parazyd | Removing the '-l' will also print out the matches so you can review. | 16:45 |
| fsmithred | I'm still getting word splitting | 16:46 |
| fsmithred | from sed | 16:46 |
| parazyd | What do you mean? | 16:46 |
| fsmithred | here's the test line. If you want to try it, set oldname=your user name | 16:46 |
| fsmithred | you need chromium installed | 16:46 |
| fsmithred | for i in $(grep -rl "/home/$oldname" /home/$oldname/.config/chromium | awk -F":" '{ print "\"" $1 "\"" }'); do sed -e "s/\/home\/$oldname/\/home\/$newname/g" $i ; done | 16:46 |
| fsmithred | oops | 16:46 |
| fsmithred | that one has the -rl instead of just -r | 16:47 |
| fsmithred | I don't think it helped. It's sed that's getting confused. | 16:47 |
| fsmithred | parazyd, the problem is that chromium has files and directories with spaces in the names | 16:47 |
| fsmithred | oh. set newname to be something else to see if it works. I used upper-case | 16:49 |
| parazyd | So this: grep -lr '/home/parazyd' .config/chromium | while read line; do sed -e "s,/home/$oldname,/home/$newname,g" "$line"; done | 16:49 |
| fsmithred | yeah | 16:49 |
| parazyd | Add "-i" to sed obviously if you want it changed | 16:49 |
| fsmithred | yeah, I removed that for testing | 16:50 |
| fsmithred | lol | 16:50 |
| fsmithred | I've been using this line for probably 8 or 9 years without problems | 16:50 |
| fsmithred | then fucking chrome decides to put spaces in their file/dir names | 16:50 |
| parazyd | yeah lol | 16:51 |
| fsmithred | oh! | 16:51 |
| fsmithred | maybe the change should be done manually inside chromium, and I should just exclude that directory | 16:52 |
| emdete | filenames may contain anything but '/' ;) | 16:52 |
| fsmithred | can does not mean should | 16:53 |
| emdete | fsmithred: yes, lets do a devuan-branded-chromium without spaces! | 16:53 |
| fsmithred | lol | 16:53 |
| fsmithred | I use chromium about one hour per week for meetings | 16:53 |
| emdete | oups, i have more programs saving config with filenames with spaces | 16:57 |
| fsmithred | yeah, this brings me to another question | 17:04 |
| fsmithred | some people expect the installer to allow them to re-use their home directory | 17:04 |
| fsmithred | so I assume that some installers do that | 17:04 |
| fsmithred | wtf do they do with all the config files? | 17:04 |
| fsmithred | in terms of user name, if that gets changed, and also in terms of old configs vs. new configs for programs. | 17:05 |
| yeti | my home never moved or was renamed | 17:08 |
| yeti | but why has chromium absolute paths in conffiles? | 17:09 |
| yeti | that's silly as hell and should use $HOME instead | 17:09 |
| fsmithred | I think they all do that | 17:18 |
| fsmithred | 462 appearances of my name in ~/.config | 17:18 |
| parazyd | yeti: Don't expect sanity from web browsers | 17:26 |
| parazyd | It is also probably an anti-feature so it keeps tracking your username if you copy your profile | 17:27 |
| emdete | fsmithred: my $HOME didnt change for several decades ;) | 23:35 |
| fsmithred | emdete, neither has mine | 23:35 |
| fsmithred | lol | 23:35 |
| fsmithred | but in the installer, you get to change the user name from whatever the default is for that live-iso | 23:36 |
| fsmithred | devuan for devuan, user for refracta, I'm not sure what others use. | 23:36 |
| emdete | do you want the installer copy homedirs into the installation? | 23:38 |
Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!