Fix Chrome User Data Dir (Quick Hack)
- Open google-chrome binary (or wrapper) in your favorite editor:
vim /usr/bin/google-chrome- Add
--user-data-dirat the very end of the exec line. Example:
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir- Save, close, and you’re done.
Now you can run Chrome without profile issues 🙂
Update: Fix Chrome User Data Dir (Modern Way)
Older trick (editing /usr/bin/google-chrome) may not work now since it’s often a binary, not a script.
Use one of these instead:
Method 1: Run directly from terminal
google-chrome --user-data-dir=/tmp/chrome-root --no-sandboxMethod 2: Update .desktop launcher
- Open:
vim /usr/share/applications/google-chrome.desktop(or copy to local first)
cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/<br>vim ~/.local/share/applications/google-chrome.desktop- Find the
Exec=line and update it like:
Exec=/usr/bin/google-chrome --user-data-dir=/tmp/chrome-root --no-sandbox %U- Save, reload apps, done.
Method 3: Simple wrapper (clean way)
vim ~/chrome-rootAdd:
#!/bin/bash<br>/usr/bin/google-chrome --user-data-dir=/tmp/chrome-root --no-sandbox "$@"Make executable:
chmod +x ~/chrome-rootRun:
~/chrome-rootNote
Chrome blocks running as root by default, that’s why --no-sandbox is needed.
This is just for testing/debugging, don’t use it for daily browsing 😄
