Linked Questions

24 votes
1 answer
151k views

How to run Bash script as root with no password? [duplicate]

Possible Duplicate: How do I use sudo in my script without needing a password? I want to run a bash script as root with no password prompt. I tried visudo with no luck(your_username ALL=(ALL) ...
Vromoth's user avatar
  • 711
1 vote
1 answer
3k views

How to run a command that requires sudo at login [duplicate]

I made a script that controls my system LEDs and it works great. I saved it to /usr/local/bin/led-pattern and ran sudo chmod a+x /usr/local/bin/led-pattern so its executable simply by entering the ...
cheesits456's user avatar
  • 1,282
-1 votes
2 answers
1k views

Suspend SUDO in Bash Script? [duplicate]

I have bash-script that uses sudo commands, but in the middle I need to stop sudo-influence and then later reinstate it. Very simple version using Pseudo code sudo apt-get install -y synaptic sudo ....
LinuxFerLife's user avatar
1 vote
2 answers
856 views

How to create a script file to input password? [duplicate]

Possible Duplicate: How do I sudo a command in a script without being asked for a password? I have a small script file, to run Nautilus as root. that reads: gksu nautilus and it prompts for ...
StanP's user avatar
  • 211
1 vote
1 answer
622 views

command which takes in password as argument? [duplicate]

Is there any bash command or technique through which we can enter in password alongwith the command which requires the password of superuser? for e.g sudo apt-get install kde <password> I am ...
MKJ's user avatar
  • 1,569
1 vote
1 answer
504 views

Run part of a command with sudo [duplicate]

I want to create a keybinding Ctrl+Alt+Delete on my Ubuntu PC. It should open htop, but I want maximum priority for it. I use this command. xterm -fullscreen -fa 'Monospace' -fs 13 -e htop It works ...
FK-VH's user avatar
  • 188
1 vote
0 answers
89 views

Execute custom bash script with sudo without passwd prompt [duplicate]

I run ubuntu-12.04 desktop x86_64. I have a simple script that needs to be accessible from the Desktop and run as root: $ cat ~/Desktop/flash.sh #!/bin/bash - cd ~/tools sudo ~/tools/fastboot-HW.sh ...
m-ric's user avatar
  • 345
0 votes
0 answers
43 views

Applying password with command in Terminal [duplicate]

Is there an option to apply a password with the command in the terminal? Somethhing like: sudo some-command -pass=mypass I'm just curious, I know that this is not safe.
Aleksandar's user avatar
0 votes
0 answers
40 views

Custom script not working as expected in ubuntu [duplicate]

I wrote a java application, want to register it as a service, so wrote a bash script in /etc/init.d/. Here is the script: #!/bin/sh # # chkconfig: 345 50 83 # ### BEGIN INIT INFO # Short ...
Ajay Kulkarni's user avatar
14 votes
2 answers
31k views

Running a script when connecting a USB device

I am trying to run a script whenever a pendrive is connected to my system. I followed this and this question and it is working, but there are still some problems. This is my udev rules file: ACTION==&...
Null pointer's user avatar
  • 2,547
-1 votes
2 answers
16k views

How to login in terminal as root anytime when I open terminal?

I don't want to type sudo and my password everytime.I think it is really annoying.Is there any command or option which will consider you root user when you open terminal,everytime When you open ...
4M01's user avatar
  • 553
0 votes
2 answers
9k views

execute shell script without entering password

I want to execute a script that requires root privileges without entering a password. There are similar questions/answers but non seems to work for me. I placed my script in /home/kf/bin (I added the ...
kasper Taeymans's user avatar
3 votes
2 answers
10k views

Mount samba share at login using startup script (not fstab)

Background I'm trying to automatically execute a command that mounts a password protected Samba share when my user logs in. The catch is, I share my laptop with another user, and I don't want the ...
Scott's user avatar
  • 428
6 votes
3 answers
4k views

How do I tell a shell script my password?

I've been trying to create a script that runs sudo apt-get update and sudo apt-get autoremove whenever I log in. It goes like this: #!/bin/bash (sudo apt-get update) (sudo apt-get autoremove) But ...
It's Willem's user avatar
4 votes
2 answers
2k views

Microsoft Arc Mouse (Bluetooth) stops scrolling after suspend Ubuntu 19.04

Update: Upgrading to Ubuntu 20.04.1 has now permanently resolved this issue for me. Edit: This is more complicated than I first noted. I don't only lose the scrolling capability on suspend, it is also ...
RaidPinata's user avatar
1 vote
2 answers
3k views

How to give a non sudoer access to a kernel module special device file?

Is it possible to access a kernel module if a user is not sudoer? I am trying to access a KVM, which is kernel module, as non-sudoer but I am getting an error: Could not access KVM kernel module: ...
user298350's user avatar
0 votes
3 answers
6k views

How to run a python script with sudo without being prompted for a password [duplicate]

I have a python script that restarts the mouse driver import os os.system("sudo modprobe -r psmouse") os.system("sudo modprobe psmouse") since my mouse doesn't always show up on start. What is a ...
Chase Mussleman's user avatar
5 votes
2 answers
2k views

Run script at user login as root, with a catch

I'm trying to run a PHP script as root on user login. The PHP script adds a Samba share to the Samba config, thus the need for root privileges. The only issue here, is that the user doesn't exist ...
nwalke's user avatar
  • 366
1 vote
5 answers
1k views

Download aborted when computer went to sleep

I was downloading a large file in my browser when my computer went to sleep. The download was lost. Any way to prevent that?
fixit7's user avatar
  • 3,117
2 votes
2 answers
3k views

Can I get Network Manager to unload/load the wireless driver?

Sometimes my wireless loses connection and will not reconnect. However, I find it will reconnect when I open terminal and run sudo modprobe -r nameOfDriver sudo modprobe nameOfDriver However, going ...
Colin Matheson's user avatar
1 vote
1 answer
3k views

Sudo execute command in Pythonscript

I want to sudo a command from a pythonscript without hardcoding my password in it. The Pythonscript is part of a webservice on Apache2. Since it is part of a webservice, asking the user each time for ...
SgtPepper88's user avatar
0 votes
1 answer
2k views

After using tablet mode touchpad and keyboard not responding on Aspire R13 - Ubuntu 15.10

I am working on an Acer Aspire R13 and everything is working fine until I close my lid to tablet (so the lid is closed but the screen is on top). After I do, touchpad and keyboard are not responding ...
narranoid's user avatar
2 votes
1 answer
2k views

Two users - how do I automount a Samba share for one user but not the other?

TLDR: I want to configure a box that is running Ubuntu Desktop and has two users so that it automounts a password protected Samba share when one user logs in, and doesn't when the other logs in. Long ...
Scott's user avatar
  • 428
0 votes
1 answer
320 views

How to bypass sudo password for everything inside a script?

I have a PADD setup on my Raspberry Pi 3 running on Ubuntu Server 20.04. I can successfully bypassed sudo password authentication by adding: pihole_display ALL=(ALL) NOPASSWD:ALL But when I try to ...
YamiYukiSenpai's user avatar
0 votes
1 answer
295 views

What are the files needs to be edit to add a user? and what to be write?

I am trying to write a C program to add a new user to my Ubuntu 14.04. I edited 1) /etc/passwd sachin:x:65535:1:sachin:/home/sachin:/bin/bash 2) /etc/shadow sachin:$6$VwBWgroA$t4KXLWIf81sWtiA1/a....
mr.Cracker's user avatar
0 votes
1 answer
280 views

run ap-hotspot commands from a saved file

How can I create a text file to automatically run these commands: sudo ap-hotspot start sudo ap-hotspot configure sudo ap-hotspot stop sudo ap-hotspot restart One file for each command. I tried ...
Ciprian's user avatar
1 vote
0 answers
264 views

Problem with gnome-terminal, but not with xterm?

I have a script called start-hotspot-terminal.sh. The text in it is: #! /bin/bash x-terminal-emulator -e "sudo /home/user/tools/start-hotspot.sh; read -p 'Press [Enter] to close terminal.';" There ...
John Red's user avatar
  • 869
1 vote
3 answers
200 views

How can i make a selfstarting script [duplicate]

I have an TL-WN727N wireless adapter connected to my laptop. Every time I start my laptop I must manually enter those two commands in a terminal: echo 'install rt2800usb modprobe --ignore-install ...
KralingenC's user avatar
0 votes
1 answer
169 views

Swap drive not turning on when I log in

Recently I added a new 40GB hard drive as swap. I want the swap to be enabled when the computer logs me in. I followed the directions here to make the swap command run on start up. I added swaps....
Blue Ice's user avatar
  • 381