gun icon indicating copy to clipboard operation
gun copied to clipboard

Unnecessarily using sudo when logging as root

Open tanducmai opened this issue 1 year ago • 7 comments

tanducmai avatar May 29 '23 07:05 tanducmai

Will merge - tho willing to help me out? Is there a way to get this script to work in non-root shells? I don't want to assume I am/only root.

amark avatar Jun 01 '23 00:06 amark

#debian/ubuntu
if [ $(id -u) -ne 0 ]; then
    SUDO='sudo'
else
    SUDO=''
fi

${SUDO} apt-get install sudo -y
${SUDO} apt-get update -y
${SUDO} apt-get install curl git git-core screen -y

#fedora/openSUSE
${SUDO} yum check-update -y
${SUDO} yum install curl git git-core screen -y

draeder avatar Jun 01 '23 00:06 draeder

Will merge - tho willing to help me out? Is there a way to get this script to work in non-root shells? I don't want to assume I am/only root.

Does the commit 67aad7e solve your problem? @amark

tanducmai avatar Jun 13 '23 13:06 tanducmai

Oh forgot about this. I need to test it against the various hosts but haven't had time. I'm really really really really dumb when it comes to CLI so I'm scared about stuff. I've gotten GUN to run on $0.83/mo shared hosts. However, some more expensive ones (not listed) $2/mo it won't let me install node or yum/apt-get, I'm not root, if I try to install NodeJS from scratch/make (not prebuilt) it takes hours & the hosts kills it. I think that machine/host I need to give up on, but I am trying to get it to work with most any shared/cpanel/would-be-PHP type hosts. Are the sudos necessary there? Or is apt-get/yum disallowed no matter what? Or?

amark avatar Jul 19 '23 04:07 amark

It might be worth rethinking this, the README section in install.sh says: "Copy paste and run each line into your terminal.", and this change makes that a bit more complicated.

Maybe just a section before each os to simplify it?

# Log in as root if you need to install sudo
su -
apt-get install sudo -y
logout

mblaney avatar Aug 08 '23 08:08 mblaney

In README tho, most users are Mac/Windows no? apt-get doesn't work either those places.

amark avatar Aug 12 '23 17:08 amark

yeah the README section mentions what to do on Windows though, so this is specifically aimed at Linux? I missed that you want people to be able to run this via curl -o- https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash, it's probably safe to assume sudo is already installed so removing these two lines makes sense:

su -
apt-get install sudo -y

mblaney avatar Aug 25 '23 07:08 mblaney