Hi,
I would like to create from command line by using the administrator user of a system the same firefox profile with plugin and customization for each user of the same … (funda kabanzi)
Hi,
I would like to create from command line by using the administrator user of a system the same firefox profile with plugin and customization for each user of the same system. I cannot use sync feature for this purpose.
I know from here edit https://developer.mozilla.org/en-US/...d_Line_Options https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options ~J99that the correct syntax is the following firefox -CreateProfile "JoelUser c:\internet\joelusers-moz-profile".
On Linux/Ubuntu the following piece of code allows to create a profile for the sudo user
user=$(sudo logname)
firefoxProfile="/home/$user/.mozilla/firefox"
if [ ! -d "$firefoxProfile/m4v6pi7q.profile" ]; then
rm -rf $firefoxProfile
firefox -CreateProfile "profile $firefoxProfile/m4v6pi7q.profile"
7z x -y ./m4v6pi7q.profile.7z
mv ./m4v6pi7q.profile/* "$firefoxProfile/m4v6pi7q.profile"
sudo chown -R $user:$user "/home/$user/.mozilla/"
rm -rf m4v6pi7q.profile.7z m4v6pi7q.profile
fi
On Windows the following piece of code allows to create a profile for the administrator user
$ProgramsPath=${env:ProgramFiles}
$FirefoxProfile="$env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles\u9w6vbcj.profile"
if(-Not (Test-Path $FirefoxProfile))
{
$LocalProfile="$env:USERPROFILE\AppData\Local\Mozilla\Firefox\Profiles\*"
if(Test-Path $LocalProfile)
{
Remove-Item $LocalProfile -recurse
}
$RoamingProfile="$env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles\*"
if(Test-Path $RoamingProfile)
{
Remove-Item $RoamingProfile -recurse
Remove-Item "$env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\profiles.ini"
}
& "$ProgramsPath\Mozilla Firefox\firefox.exe" -CreateProfile "profile $FirefoxProfile"
& "$ProgramsPath\7-Zip\7z.exe" x -y .\u9w6vbcj.profile.7z
move .\u9w6vbcj.profile\* $FirefoxProfile -force
Remove-Item .\u9w6vbcj.profile.7z
Remove-Item .\u9w6vbcj.profile
}
How can I create firefox profiles from a sudo/administrator user for each user (sudo/administrator and not sudo/administrator) of the system?
On Linux/Ubuntu I tried with this code
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"
7z x -y ./m4v6pi7q.profile.7z
mv ./m4v6pi7q.profile/* "$firefoxProfile/m4v6pi7q.profile"
chown -R $systemUser:$systemUser "/home/$systemUser/.mozilla/"
rm -rf m4v6pi7q.profile.7z m4v6pi7q.profile
done
but it does not work and this is the output
sudo ./user.sh
foo
Success: created profile 'profile /home/foo/.mozilla/firefox/m4v6pi7q.profile' at '/home/foo/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
admin
Success: created profile 'profile /home/admin/.mozilla/firefox/m4v6pi7q.profile' at '/home/admin/.mozilla/firefox/m4v6pi7q.profile/prefs.js'
jack
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
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'm sorry for my very long question. Thank you
edit fixed link ~J99