Which of the following two commands should I use?
Code:
$ su -l devel
$ sudo -iu devel
Whichever you prefer...
su -l <user> will log you in as that user with that user's environment. As in fully simulating the login. just su <user> or sudo -u <user> <command> do not do this, then environment is inherited from the user running it (that's you in this case.
sudo -iu <user> will long you in as the target user.
man sudo
man su
Superficially, none. Going deeper, it depends on your system. A properly configured sudo-system limits access and allows granular controls. This would include preventing the use of su. But most sudo systems are not. And most do not need to be because they're single user desktops. So I don't even use sudo on my rig.
Sorry if I confused you, I just want to outline that you had choice because Linux is about choice.
Entirely based on what your development user needs access to. So, for one example, you may need access to removeable storage or network devices, so plugdev and netdev... This is where you need to use a websearch for your specific needs. You may have to add your own user group to be able to access your files, but then this removes the isolation part. This is very much a preference versus practice thing and it'll be a merry-go-round so I suggest
Could you explain yourself better?
Not much more than I have. The problem if we're jumping from one thing to another, and there's going to be a lot of confusion as one item bleeds into the next. So maybe let's keep it simple and avoid the elaborate. Here's a proof-of-concept (PoC) script for hacky VCS:
I'm calling it "vcs_make.sh". Copy it into the same dir as you'd run make and run it instead.
Bash:
#! /bin/bash
# !! Run this in the directory containing makefile !!
# Need this info later (you'll see)
iiAppDir=$(basename "$(pwd)")
# Create a suffix for backup directories. Change the format as you see fit
iiBackupSuffix="bkp_$(date +%Y-%m-%d__%H-%M.%S)"
# You can add sanity, I'm too lazy (run configure if it exists)
if [ -e "configure" ]; then
./configure
fi
# Okay, build!
make
# You can add sanity check code here, too, I'm too lazy.
# Goes up, copies the app to a time-stamped backup.
# Note you can use tar and xz to archive larger builds...But this is PoC code, use it as boilerplate
cd ..
cp -r "$iiAppDir" "$iiAppDir.$iiBackupSuffix"
cd "$iiAppDir"
There. You can now use this. Please note I haven't tested it so check for typos, etc. If you don't know what's going on, feel free to ask, but I suggest you just do a 30-min crash course on Bash or ask Bing/WhateverAI to help improve it and make it useable.