erotavlas
February 28th, 2016, 05:50 PM
Hi,
I have a strange problem with a script that creates firefox profiles via command line. I can create a single profile for the sudo user while I cannot create the profiles for the other normal and sudo users. I read here https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options that the correct syntax is the following firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile". I found on the web a command that retrieves all the user in a system. Then I added a loop over the users and the previous command.
usersList=$(getent passwd | grep -vE '(nologin|false)$' | \
awk -F: -v min=`awk '/^UID_MIN/ {print $2}' /etc/login.defs` \
-v max=`awk '/^UID_MAX/ {print $2}' /etc/login.defs` \
'{if(($3 >= min)&&($3 <= max)) print $1}' | \
sort -u)
for systemUser in $usersList; do
echo $systemUser
firefoxProfile="/home/$systemUser/.mozilla/firefox"
firefox -CreateProfile "profile $firefoxProfile/m4v6pi7q.profile"
chown -R $systemUser:$systemUser "/home/$systemUser/.mozilla/"
done
The problem is that if I have four-five users, the command works only for the current user that executes the script with sudo privilegios and for the first user in the list.
This is the output
admin sudo user
sudo ./user.sh
foo
(process:19288): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/foo/.mozilla/firefox/m4v6pi7q.profile' at '/home/foo/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
admin
(process:19297): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/admin/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
jack
(process:19306): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/jack/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
chown: cannot access ‘/home/jack/.mozilla/’: No such file or directory
zorro
(process:19315): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/zorro/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
chown: cannot access ‘/home/zorro/.mozilla/’: No such file or directory
Why for the first two users is the directory for profile corretly set, while for the other is the directory of the user that executes the script /home/admin/.mozilla/firefox/m4v6pi7q.profile?
I cannot understand if it is my fault or something else...thank you
I have a strange problem with a script that creates firefox profiles via command line. I can create a single profile for the sudo user while I cannot create the profiles for the other normal and sudo users. I read here https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options that the correct syntax is the following firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile". I found on the web a command that retrieves all the user in a system. Then I added a loop over the users and the previous command.
usersList=$(getent passwd | grep -vE '(nologin|false)$' | \
awk -F: -v min=`awk '/^UID_MIN/ {print $2}' /etc/login.defs` \
-v max=`awk '/^UID_MAX/ {print $2}' /etc/login.defs` \
'{if(($3 >= min)&&($3 <= max)) print $1}' | \
sort -u)
for systemUser in $usersList; do
echo $systemUser
firefoxProfile="/home/$systemUser/.mozilla/firefox"
firefox -CreateProfile "profile $firefoxProfile/m4v6pi7q.profile"
chown -R $systemUser:$systemUser "/home/$systemUser/.mozilla/"
done
The problem is that if I have four-five users, the command works only for the current user that executes the script with sudo privilegios and for the first user in the list.
This is the output
admin sudo user
sudo ./user.sh
foo
(process:19288): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/foo/.mozilla/firefox/m4v6pi7q.profile' at '/home/foo/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
admin
(process:19297): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/admin/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
jack
(process:19306): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/jack/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
chown: cannot access ‘/home/jack/.mozilla/’: No such file or directory
zorro
(process:19315): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Success: created profile 'profile /home/zorro/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
chown: cannot access ‘/home/zorro/.mozilla/’: No such file or directory
Why for the first two users is the directory for profile corretly set, while for the other is the directory of the user that executes the script /home/admin/.mozilla/firefox/m4v6pi7q.profile?
I cannot understand if it is my fault or something else...thank you