Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script shouldn't run as root user #386

Closed
Armanmd opened this issue Jun 20, 2017 · 17 comments
Closed

Script shouldn't run as root user #386

Armanmd opened this issue Jun 20, 2017 · 17 comments
Assignees

Comments

@Armanmd
Copy link

Armanmd commented Jun 20, 2017

i install script again but still not working

installtion commend:

cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh | bash

output 👎
#:sudo -E hardcode-tray
Script shouldn't be run as root

(For information i use Papirus icon theme)

@bilelmoussaoui
Copy link
Owner

You should upgrade your script using hardcode-tray --update-git

@Armanmd
Copy link
Author

Armanmd commented Jun 20, 2017

try1:
#:hardcode-tray --update-git
Script shouldn't be run as root
try2:
#:sudo hardcode-tray --update-git
Script shouldn't be run as root
try3:
#:sudo -E hardcode-tray --update-git
Script shouldn't be run as root

Not working yet

@bilelmoussaoui
Copy link
Owner

Can you upgrade the script without using root permission and then try again?

@Armanmd
Copy link
Author

Armanmd commented Jun 20, 2017

i cant

@Armanmd
Copy link
Author

Armanmd commented Jun 20, 2017

what to do ?

@bilelmoussaoui
Copy link
Owner

Remove the script : https://github.com/bil-elmoussaoui/Hardcode-Tray#uninstallation
& then reinstall it again

@Armanmd
Copy link
Author

Armanmd commented Jun 20, 2017

try1:(here i removed script)
#:cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/uninstall.sh | bash
--2017-06-20 07:49:56-- https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/uninstall.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.64.133, 151.101.128.133, 151.101.192.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.64.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 164 [text/plain]
Saving to: ‘STDOUT’

                100%[===================>]     164  --.-KB/s    in 0s      

2017-06-20 07:49:57 (79.8 MB/s) - written to stdout [164/164]

try2:(test remove script)
#:hardcode-tray
hardcode-tray: command not found

try3:(reinstall script)
#:cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh | bash
--2017-06-20 07:50:39-- https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.192.133, 151.101.64.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1848 (1.8K) [text/plain]
Saving to: ‘STDOUT’

                100%[===================>]   1.80K  --.-KB/s    in 0s      

2017-06-20 07:50:46 (71.2 MB/s) - written to stdout [1848/1848]

Downloading Hardcode-Tray ...
Downloading the latest version...
Creating symbolic link..
Installation completed successfully.
You can run the script using 'hardcode-tray'

try4:(test script)
#:hardcode-tray
Script shouldn't be run as root

not working yet

@bilelmoussaoui
Copy link
Owner

Follow those steps please:
1 - rm -rf /opt/Hardcode-Tray
2 - rm -f /usr/bin/hardcode-tray
3 - cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh
4 - chmod +x ./install.sh
5 - ./install.sh --g

@Armanmd
Copy link
Author

Armanmd commented Jun 21, 2017

ok let me to test i will tell you it work? !

plz dont close issue

@Armanmd
Copy link
Author

Armanmd commented Jun 22, 2017

**root@Kali:~# **cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh
`--2017-06-22 03:24:46-- https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/data/install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.192.133, 151.101.0.133, 151.101.64.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.192.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1848 (1.8K) [text/plain]
Saving to: ‘STDOUT’

0%[ ] 0 --.-KB/s #!/bin/bash
cd /tmp || exit
Remove tmp folder
if [ -d "/tmp/Hardcode-Tray/" ]; then
sudo rm -rf /tmp/Hardcode-Tray
fi
echo "Downloading Hardcode-Tray ..."

Git version
if [ "$1" == "--g" ]; then
echo "Cloning the repository..."
if [ -d "./Hardcode-Tray" ]; then
rm -rf /tmp/Hardcode-Tray
fi
git clone https://github.com/bil-elmoussaoui/Hardcode-Tray
cd ./Hardcode-Tray
else
echo "Downloading the latest version..."
version=$(git ls-remote -t https://github.com/bil-elmoussaoui/Hardcode-Tray.git | awk '{print $2}' | cut -d '/' -f 3 | cut -d '^' -f 1 | sort -b -t . -k 1,1nr -k 2,2nr -k 3,3r -k 4,4r -k 5,5r | uniq)
IFS=' ' read -r -a versions <<< "$version"
version=${versions[0]}
wget -q https://github.com/bil-elmoussaoui/Hardcode-Tray/archive/"$version".zip
unzip -oq "$version".zip
rm -f "$version".zip
versionnb=${version//[a-zA-Z]/}
cd ./Hardcode-Tray-"$versionnb" || exit
fi

Remove unneeded files
rm -rf .git ./screenshots
rm -f .gitignore README.md data/install.sh data/uninstall.sh

cd ../ || exit
Remove installed version
if [ -d "/opt/Hardcode-Tray" ]; then
sudo rm -rf /opt/Hardcode-Tray
fi

Copy the new version
if [ "$1" == "--g" ]; then
sudo mv Hardcode-Tray/ /opt/Hardcode-Tray
else
sudo mv Hardcode-Tray-"$versionnb"/ /opt/Hardcode-Tray
fi

echo "Creating symbolic link.."
Remove symbolic link
if [ -L "/usr/bin/hardcode-tray" ] || [ -f "/usr/bin/hardcode-tray" ]; then
sudo rm -f /usr/bin/hardcode-tray
fi

Create a symbolic link
sudo ln -s /opt/Hardcode-Tray/hardcode-tray /usr/bin/hardcode-tray

if [ "$1" == "--u" ]; then
echo "The update has completed successfully."
elif [ "$1" == "--g" ]; then
echo "Hardcode-Tray was updated to git version successfully."
else
echo "Installation completed successfully."
fi
echo "You can run the script using 'hardcode-tray'"
100% [===================>] 1.80K --.-KB/s in 0s

2017-06-22 03:24:47 (64.6 MB/s) - written to stdout [1848/1848]`

root@Kali:/tmp# chmod +x ./install.sh
chmod: cannot access './install.sh': No such file or directory
root@Kali:/tmp#chmod +x install.sh
chmod: cannot access 'install.sh': No such file or directory
root@Kali:/tmp#

root@Kali:/tmp# ls
ssh-aywEkWXNiJag systemd-private-728561bb22614695a5664dda0b076506-rtkit-daemon.service-5hlKpj
systemd-private-728561bb22614695a5664dda0b076506-colord.service-NkuGsh tracker-extract-files.0

@Armanmd
Copy link
Author

Armanmd commented Jun 22, 2017

not working.what to do?

@bilelmoussaoui
Copy link
Owner

bilelmoussaoui commented Jun 22, 2017

Please follow the steps. And use Github markdown to share the correct terminal output. As I don't really know which step gives you which output :/

@Armanmd
Copy link
Author

Armanmd commented Jun 23, 2017

hi i install hardcode-tray with your ppa but hardcode-tray not working

root@Kali:~# hardcode-tray
Traceback (most recent call last): File "hardcode-tray.py", line 25, in <module> from src.app import App File "/opt/Hardcode-Tray/src/app.py", line 25, in <module> from src.const import DB_FOLDER File "/opt/Hardcode-Tray/src/const.py", line 29, in <module> USERHOME = get_userhome(USERNAME) File "/opt/Hardcode-Tray/src/tools.py", line 33, in get_userhome userhome = path.join("home", username) File "/usr/lib/python3.5/posixpath.py", line 89, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types (funcname, s. class . name )) from None TypeError: join() argument must be str or bytes, not 'NoneType'

@bilelmoussaoui
Copy link
Owner

The script wasn't created to be run as root :( i will see if i can reproduce this and fix it

@Armanmd
Copy link
Author

Armanmd commented Jun 23, 2017

I can not fix it
And I will wait

@AndydeCleyre
Copy link

@Armanmd Why do you want to run as root? You almost definitely should not be doing that. Please format code and console stuff so that people can read it more easily.

@bilelmoussaoui
Copy link
Owner

Should be fixed on master. Tried it and it works as expected :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants