LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 09-03-2009, 01:48 PM   #1
el_b
Member
 
Registered: Apr 2009
Distribution: Slackware 13.0
Posts: 48

Rep: Reputation: 17
Config file on user login, running command as root?


I'm trying to get snd-usb-audio to work for my MIDI USB interface at startup. It works, but every time I login I have to run a terminal as root and type "modprobe snd-usb-audio". The reason for this is that I blacklisted it in /etc/modprobe.d/blacklist, since it was breaking ALSA every time I turned on my laptop.

So, is there any way to get this to work, making the audio device default instead of "USB MIDI Interface", or to simply automatically run "modprobe snd-usb-audio" as root every time I log in?

Thanks in advance.
 
Old 09-04-2009, 09:25 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,585
Blog Entries: 15

Rep: Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537Reputation: 1537
If you login as root every time you could do this simply by adding the commands to your .bashrc or .bash_profile (assuming bash, .profile if ksh or .cshrce is csh).

If you login as a regular user you could do the same but would want to configure sudo to allow your user account to run the requisite commands as root. Type "man sudo" then "man sudoers" for more details of how to setup sudo. (Be sure to use visudo to modify sudoers when you get that far.)

By default sudo would require you to enter your password a second time when it was invoked but you could avoid that but using the RUNAS specification in the sudoers file.
 
Old 09-04-2009, 04:11 PM   #3
el_b
Member
 
Registered: Apr 2009
Distribution: Slackware 13.0
Posts: 48

Original Poster
Rep: Reputation: 17
Thanks, it works flawlessly.

.bashrc isn't loaded with X, I had to add it to Autostarted Applications.

Here's my /etc/sudoers, I made it as secure as possible:
Code:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults	env_reset

# Host alias specification

Host_Alias	LOCALHOST = localhost #not sure if this is useful...

# User alias specification

User_Alias	SNDUSBUSERS = me

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL) ALL
SNDUSBUSERS 	LOCALHOST = NOPASSWD: /sbin/modprobe snd-usb-audio
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a command on root login - can auditd do this? Firebar Linux - Security 3 08-11-2009 08:23 AM
Running a command as another user in a bash script ran as root? camphor Programming 2 03-29-2009 04:11 PM
running file from root and running file from user kedar Linux - Newbie 2 09-16-2008 02:59 AM
Gnome: Cannot login as default user, sends back to login, works as root Danny-T Linux - Newbie 2 05-27-2006 04:44 AM
User Login Problem: "command not found" unless root! DreameR-X Linux - General 15 12-21-2004 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration