Run IPFS commands as IPFS User when logged in as yourself on Linux Mint 21.x
Contents
Introduction
How to run ipfs commands as the ipfs user rather than as your standard user role on Linux
This is for your if your seeing something like the following when running ipfs id
- Seeing that you should init ipfs when you have already set up the ipfs user to run the ipfs daemon for you means should move on to the next section and don’t run the init.
ipfs id Error: no IPFS repo found in /home/yourUserNameHere/.ipfs. please run: 'ipfs init'
OR
- If you left your
/home/yourUserNamehere/.ipfs
data in place after moving to running ipfs as the ipfs user and are running into a situation when things are in the ipfs-cluster but not showing up when running the ipfs command as yourself. If you did leave your data inplace migrate, backup or delete it as appropriate, then move on to the next section.
How to Run ipfs commands as the ipfs user while being yourself.
- Add your user in my case it was
daniel
to the group
sudo usermod -aG ipfs daniel
- Apply new group setting to existing login session then logout / reboot to persist these settings as soon as possible.
newgrp ipfs
- Fix permissions on the ipfs owned .ipfs dir so your user can access it as your user.
sudo chmod -R 770 /home/ipfs/.ipfs
- Set a custom IPFS path in environment variables, add the following lines to your
~/.bashrc
file etc.
# Set IPFS_PATH so ipfs commands will run as the ipfs user.
export IPFS_PATH=/home/ipfs/.ipfs
Conclusion
Now when ipfs commands are run you should have full and up-to-date information as processed in your ipfs-cluster.