libera/#devuan-dev/ Tuesday, 2021-02-02

emdetefsmithred: the 5th field in /etc/passwd - wasnt the name "gecoes" or something...?09:42
emdeteah, mason already answered that one ;)09:43
emdetefsmithred: 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 username09:50
onefangThat field is entirely useful stuff like room number, real name, phone number, etc.10:02
fsmithredemdete, 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
fsmithredinstaller has the following in it:13:52
fsmithred#sed -i~ "s/$old_realname,,,/$new_realname,,,/" /target/etc/passwd13:52
fsmithredchroot /target /bin/bash -c "chfn -f '$new_realname' $newname"13:52
fsmithredI haven't figured out what to do about the filenames with spaces. Tried a few different ways to quote, but none worked.13:55
emdetefsmithred: yes, that `sed -i~ "s/$old_realname..` is the line in question, will check for an alternative, give me a minute16:06
fsmithredemdete, 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
emdeteah, you are right - there is a prgram for that already!16:15
fsmithredwhat does that do?16:15
fsmithreddoes that awk do something with the other fields if they are full?16:16
emdetereplaces the 5th element in a line of the user (in that case user root gets gecoe Rob Ott)16:16
emdeteit overwrites the 5th but locates by username, not by the old gecoe16:16
emdeteno, it doesnt16:17
fsmithreddon't worry about it16:17
emdetebut you are right chfn is the way to go ;)16:17
fsmithredthe 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
emdeteprobably there is a awk in that thingie16:18
emdetepasswords are in shadow, the second field is unused or am i wrong?16:19
fsmithredyeah, in shadow. Not sure which field without looking.16:19
emdetewhat 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
fsmithredthe installer gives four choices: keep root account and nobody gets sudo16:22
fsmithreduse sudo and disable root account16:22
fsmithred^^^ that's the one I was talking about16:22
fsmithreduse sudo and keep root account16:23
emdeteah, ok.16:23
fsmithreduse sudo for shutdown and keep root account16:23
fsmithredthat last one is my favorite16:23
fsmithredsudo nopasswd for shutdown/reboot16:23
emdeteok, sounds reasonable (i would add pm-suspend)16:24
fsmithredso yeah, it's the second field in /etc/shadow16:24
fsmithredyeah, suspend is included, pretty sure.16:24
fsmithredmy own rig has several others added to the list.16:24
emdetei 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
fsmithredchsh -s /sbin/nologin root16:30
emdeteand that doesnt work?16:31
fsmithredThere's chpasswd which works in batch mode16:31
fsmithredI assume chsh works. It's not in the script (yet).16:31
emdeteah, ok :)16:31
emdetegive me some time, i will check for the quoting of the filenames...16:32
fsmithredit's a 10-year-old script that has had features stuck onto it that entire time16:32
fsmithredI can get awk to spit out the list of filenames with quotes, but then sed chokes on it.16:33
fsmithredand the sed command is already using double quotes for the variables16:34
fsmithredoh, the filenames aren't part of the substitution.16:35
yetiplural?  filenames from find?16:38
yetimaybe   xargs -0   can help?16:39
fsmithredno, it's a for loop16:40
yeti:-(16:40
fsmithredlooking inside files in .config and .local for files that contain /home/username16:40
fsmithredto change old username to new one16:41
fsmithredI'm guessing there's not a cool linux command to do that16:41
fsmithredhm16:42
fsmithredmaybe find is the way to go16:42
yetireminds me of BS we did in BASIC days by adding cursor movement into the lines so that listing the program could do funny things16:44
parazydfsmithred: Try `grep -rl '/home/username' /home/username/.config /home/username/.local16:44
yetifilenames even might contain newlines16:45
parazydRemoving the '-l' will also print out the matches so you can review.16:45
fsmithredI'm still getting word splitting16:46
fsmithredfrom sed16:46
parazydWhat do you mean?16:46
fsmithredhere's the test line. If you want to try it, set oldname=your user name16:46
fsmithredyou need chromium installed16:46
fsmithredfor i in $(grep -rl "/home/$oldname" /home/$oldname/.config/chromium | awk -F":" '{ print "\"" $1 "\"" }'); do sed -e "s/\/home\/$oldname/\/home\/$newname/g" $i ; done16:46
fsmithredoops16:46
fsmithredthat one has the -rl instead of just -r16:47
fsmithredI don't think it helped. It's sed that's getting confused.16:47
fsmithredparazyd, the problem is that chromium has files and directories with spaces in the names16:47
fsmithredoh. set newname to be something else to see if it works. I used upper-case16:49
parazydSo this: grep -lr '/home/parazyd' .config/chromium  | while read line; do sed -e "s,/home/$oldname,/home/$newname,g" "$line"; done16:49
fsmithredyeah16:49
parazydAdd "-i" to sed obviously if you want it changed16:49
fsmithredyeah, I removed that for testing16:50
fsmithredlol16:50
fsmithredI've been using this line for probably 8 or 9 years without problems16:50
fsmithredthen fucking chrome decides to put spaces in their file/dir names16:50
parazydyeah lol16:51
fsmithredoh!16:51
fsmithredmaybe the change should be done manually inside chromium, and I should just exclude that directory16:52
emdetefilenames may contain anything but '/' ;)16:52
fsmithredcan does not mean should16:53
emdetefsmithred: yes, lets do a devuan-branded-chromium without spaces!16:53
fsmithredlol16:53
fsmithredI use chromium about one hour per week for meetings16:53
emdeteoups, i have more programs saving config with filenames with spaces16:57
fsmithredyeah, this brings me to another question17:04
fsmithredsome people expect the installer to allow them to re-use their home directory17:04
fsmithredso I assume that some installers do that17:04
fsmithredwtf do they do with all the config files?17:04
fsmithredin terms of user name, if that gets changed, and also in terms of old configs vs. new configs for programs.17:05
yetimy home never moved or was renamed17:08
yetibut why has chromium absolute paths in conffiles?17:09
yetithat's silly as hell and should use $HOME instead17:09
fsmithredI think they all do that17:18
fsmithred462 appearances of my name in ~/.config17:18
parazydyeti: Don't expect sanity from web browsers17:26
parazydIt is also probably an anti-feature so it keeps tracking your username if you copy your profile17:27
emdetefsmithred: my $HOME didnt change for several decades ;)23:35
fsmithredemdete, neither has mine23:35
fsmithredlol23:35
fsmithredbut in the installer, you get to change the user name from whatever the default is for that live-iso23:36
fsmithreddevuan for devuan, user for refracta, I'm not sure what others use.23:36
emdetedo 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/!