0

I recently decided to get rid of windows and install Linux on my Computer. So far it has been a good experience. However, one of the main things that was worrying me was the fact that I maybe could not control the fan speed as I was able to with Windows 10. Acer had released some time ago a utility to control the fan speed and it worked wonderfully. Thankfully however, I managed to find a perl script that does the exact same thing on Linux, and it works like a charm when I run it with sudo, however, whenever I simply run it without sudo, it gives me an access denied message about /dev/port.

Permission denied

I want to be able to run this script without root access and even write a bash script for it (Maybe even a complete port with a GUI like the original Acer app), but as long as this /dev/port issue remains, I can't do anything because I will always need to enter my password.

I have searched and I am indeed a member of the dialout group, having restarted and relogging multiple times, but even that doesn't help me. I have also tried looking at the source code of this perl script but I just can't wrap my head around it, seeing as it has a lot of assembly magic.

Groups

So my question is this: I want to execute a perl script that requires access to /dev/port without running it using sudo, but even if I am in the dialout group, it still gives me the error. What am I doing wrong?

My guess is that the ports that this script needs do not belong to the dialout group but some other group, like tty, but I can't add myself to the tty group.

Regardless, thanks.

1

on my system:

amias@rome:~$  ls -l /dev/port
crw-r----- 1 root kmem 1, 4 May 27 10:53 /dev/port

This suggests that you need to run it via sudo, i would also resist the temptation to open up the permissions to /dev/port as it will weaken your security.

What you could do is configure sudo to allow you to run that script as root without a password.

sudo visudo                # launch the safe sudo config editor

then add the following line at the bottom of the file substituting your values for user and the path to the script

user localhost = (root) NOPASSWD: /full/path/to/script

It would be wise to make that script be owned by root and not writable by anyone else but root, an attacker could find out that it will be run as root and could insert other commands that could compromise your system.

| improve this answer | |
  • I did everything you said, now I have my wanted result. I also changed the permissions for it with the help of this and now I have no issues at all. Thanks for the help. – jason0597 May 28 '16 at 12:16
  • I did everything you said, along with making it accessible by root only, but now when I try to write a bash script that I can just execute, it requires me to enter my password. Do I have to make that not request a password as well, and make it read only? – jason0597 May 28 '16 at 12:24
  • you should only allow scripts to run as root if you totally trust them not to destroy your system. Did you mean that you are always prompted for a your password when you RUN the script ? it would not be correct to configure /full/path/to/script as /bin/bash , this would make every script run as root which you definitely don't want to do. Make sure your system can resolve localhost to 127.0.0.1 – Amias May 28 '16 at 12:28
  • it might be easier to ask another question seperately as the comment section is not so good for detailed explanations – Amias May 28 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.