General :: How To Alias A Command For Sudo

Sep 25, 2010

I have an alias that I would like to use both as a regular user and as root, via sudo. Specifically, it is this:

alias rm=trash This works fine as a normal user, and it works fine when I use sudo -i to get a root shell prompt, but if I use sudo rm, the alias does not apply. So where do I need to put my alias so that it works in one-off sudo commands?

View 1 Replies


ADVERTISEMENT

General :: Sudo Cd /root Gives Sudo - Cd - Command Not Found

Jan 6, 2011

Kernel 2.6.21.5, Slackware 12.0

Code:

Code:

On the other hand

Code:

So, I do not understand why the notification "sudo: cd: command not found", considering cd is a bash built-in command.

View 3 Replies View Related

General :: Used Alias Command For Ll And Now Ll Is Not Recognized?

Dec 3, 2010

I used the alias command to make ll be ll -lrt. I have linux 5 and using the bash shell. now I can't even use ll, only ls. when I go into the bin directory, ll is not in the list and the normal color codes for bash are not showing either...folders blue, etc

View 4 Replies View Related

General :: Setup An Alias Or Shortcut To Do The *nix Find Command?

Apr 5, 2011

When at the command line, I find that I have to type out this command very often: find . -iname "*php" -exec grep -H query {} ; I'd love to set up an alias, script, or shortcut to make it work easier. I would like to do something like: mysearch query ("*php") (.) It would be great if the command could accept three arguments, in reverse order:

query string, file name expression, directory If the second two arguments were omitted they would default to not being included, and the current directory. Finally, the icing on the cake would be that if additional variables were included (4th, 5th, 6th...) they would be injected as additional arguments for the find command (like I could say -type d) at the end. Attempted code I tried the example below, but I'm still having trouble setting default values. What am I doing wrong?

#!/bin/bash
c=${param1+.}
b=${param2+*}
a=${param3+test}
find $c -iname $b -exec grep -H $a {} ;

View 1 Replies View Related

General :: Using Shortcuts/alias Inside A Bash Command?

Jan 28, 2010

I know that using alias I can run a whole command with a shortcut. But my requirement is to use parts of a long command and in between I have to pass some user defined values.
E.g. Suppose I have to routinely copy a directory to another remote directory on a remote machine.The remote machine name is quite long as well as the directory path to which I want to copy the files into.So the command to do scp would look like this[URL]Now I want to do some sort of aliasing (say "ecp") so that I just need to pass the source_directory name and the ecp command and do my job

View 3 Replies View Related

General :: Alias A Device For The Mount Command In RedHat 9?

Aug 9, 2011

I have a program which mounts /dev/sdb1 for which I lack the source code. This device does not exist on my RedHat 9 system and I want to create /dev/sdb1 such that it's an alias for /dev/hdb1 Can I do this? with MAKEDEV?

I need to have an alias which will allow it to mount, not create a symbolic link to an already mounted directory. i.e. 'mount /dev/sdb1 /mnt/harddrive' should actually mount /dev/hdb1

View 7 Replies View Related

Fedora Security :: Sudo NOPASSWD To BashRC Alias?

Aug 25, 2011

I've set up an alias in .bashrc (let's call it alias1), and am trying to set up a sudo NOPASSWD rule for that particular command. So far, I've attempted:
user ALL = NOPASSWD: alias1
user ALL=(ALL) NOPASSWD: alias1
But keep getting told I have a syntax error - presumably this is because visudo doesn't recognise alias1? I've already checked that alias1 works correctly, so I assume I'm just referring to it incorrectly.

View 6 Replies View Related

General :: Setup An "alias" Command For IDL?

Jan 25, 2011

I have installed IDL 7.1 on my Ubuntu 9.10. And now the instruction says that I should set up an "alias" for it.I do not know what to write in my "bashrc" as an alias for IDL.
These are the place of the executable command of IDL:

/IDL/idl-7.1/bin/idl
AND
/IDL/idl-7.1/bin/idlde

Note that "idl" and "idlde" are the executable files which run the program by typing them in Terminal. I would be very grateful if anyone could help me in how to write an "alias" for my IDL.

View 7 Replies View Related

Ubuntu :: How To Permanently Alias Command

Mar 6, 2010

My current alias'd commands are:

alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'

I'd like to change 'ls' and add a few more, is there a command to permanently do that, or a config file I need to edit somewhere?

View 2 Replies View Related

General :: Execute A Command After Sudo?

May 4, 2011

I am working in a CentOS environment with numerous CentOS machines. Currently there are multiple developers that each have their own login/home directory and then for various admin tasks we all share a single super user account.

The problem

I have a number of aliases, variables, functions, and settings that exist in my personal login's .bash_profile. None of these are available in the shared super user's .bash_profile. My current work around is that everytime I sudo in as the super user and I re-execute my .bash_profile from my personal user's home directory. I am not allowed to edit the init stuff for the super user

The Question

Is there any way I can automate my sudo sequence such that it will execute my personal .bash_profile after I've executed sudo without requiring me to edit the super user's bash init stuff?

View 3 Replies View Related

General :: Write A Script To Sudo The Last Command?

Feb 19, 2011

for some commands such as apt-get install xxx, I forget to add sudo first, then I need to retype it. What I want is in such cases, I just type a simple command, for example resudo. It will sudo my last command sudo apt-get install xxx. Is it possible in bash?

View 1 Replies View Related

General :: Run Ubuntu Command Sudo Apt-get In Mandriva?

Sep 12, 2011

How i can run the following command (for Ubuntu) in Mandriva 2005 ? What is the similar command ?

sudo apt-get install python-wxgtk2.8 pyro mercurial build-essential bison flex mercurial python-numpy

View 1 Replies View Related

General :: Execute Root Command Without Sudo?

Jan 24, 2010

On my ubuntu I have a command pm-suspend, which puts the computer to sleep. It has to be run with sudo. Since it is inconvenient to be forced to type the password every time I want my computer to sleep, I thought maybe there's a way around it. Naively I thought that if I'd create a script as root, that invokes pm-suspend, and then let anyone execute that script, I could run that script as my own user and then that script would be considered run by root and hence be allowed to run pm-suspend. Obviously that didn't work. The root-check procedure in pm-suspend still found out that the original executor was someone different from root.

Still I think something similar (although slightly more elaborate) should work.I'm thinking about the process that allows the user to mount hard drives for example. Normally root is required, but it is somehow bypassed by the gnome utility mounting.

View 8 Replies View Related

General :: Sudo Versus SU - SAX2 Command?

Jun 3, 2010

I've been using SuSE for a while and something has been bugging me. Not a show stopper, but nevertheless, an interesting one. Most tutorials, forum posts, etc. recommend using a sudo command to accomplish stuff. For example:

Code:
sudo make install
sudo vi file

However, this does not always work. For instance, I was recently working on a resolution problem with my ViewSonic VX922 - it would only display at 1024x768 rather than the native 1280x1024. Viewing some posts, I found the command "sudo sax2 -r". What I discovered is that there seems to be a big difference between sudo and su

Code:
drkhelmt@SPACEBALL1:">sudo sax2
root's password:
sudo: sax2: command not found
drkhelmt@SPACEBALL1:">su
Password:
SPACEBALL1:/home/drkhelmt: #sax2
SaX: Checking update status for intel driver
SaX: initialization already done
SaX: cal [ sax2 -r ] if your system has been changed !
SaX: startup
SaX: X server:0.0-> grant
SaX: importing current configuration
SPACEBALL1:/home/drkhelmt: #

So the question, why does the command sax2 (and others) work when after the su command rather than a sudo?

View 5 Replies View Related

General :: Sudo Command Doesn't Work

Oct 17, 2010

I want to install some software using sudo apt-get command,but it dosen't work.(my network works well) how to handle it? below is the output of terminal:

@ubuntu:~/Downloads$ sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4
Reading package lists... Done
Building dependency tree

[Code].....

View 4 Replies View Related

General :: Usage Of Sudo Command In Ubuntu And Red Hat?

Apr 18, 2010

In Red Hat, suppose if root user wishes to give a privilege to run the fdisk command to a user named sam.And he makes appropriate configuration changes in /etc/sudoers file. Now when sam wishes to run the fdisk command, then he has to issue:

Code:
[sam@system43~]$sudo /sbin/fdisk -l
Password: But in ubuntu, after the same configuration being done, what sam needs to do is:
Code:
[sam@somesystem43~]$sudo fdisk -l
Password: ***

That means, in ubuntu the user need not type the full path of the command. I wish to know how can I make red hat system work like ubuntu as far as the sudo usage is concerned.

View 3 Replies View Related

Ubuntu :: Bashrc Ls Alias Not Working Same As Command Line

Oct 25, 2010

I have a few alias' in my .bashrc to save some typing, mostly ls type variants.

I wanted to add the following:
- give me a Long listing of ALL in Reverse Time order, (don't recurse directory)

Code:

But it doesn't work anything like the way it does on the command line

When I use the alias I get the following:

Code:

No Time, No Permissions, no group/owner ... , Why?

View 2 Replies View Related

General :: Automate Sudo Su - User Command From A Script?

Feb 9, 2011

i want to automate sudo su - user command from a script...it will then ask for a password...how do i automate this?

View 3 Replies View Related

General :: Aliases Work After Running Sudo SU Command?

May 7, 2010

I can make aliases fine by editing the .bashrc file in my home directory, but the first thing I do when I open a terminal window is sudo su so I don't have to type sudo in front of every command. The problem is, I am then not able to use my aliases. How can I make aliases that work after I run the sudo su command?

View 2 Replies View Related

General :: Sudo For A Single Command With No Password Entry

Apr 20, 2010

I wish to allow a user to use sudo to run a single command (service app status) to determine if my application app is running, in my sudoers file i have: user ALL= /sbin/service app status I understand that there is a parameter called timestamp_timeout that will set the timeout for the 'user', but requires at least 1 entry of the root password.

I wish to allow the user to do "sudo service app status" and not have to enter the root password ever(maybe once is ok), but still make the user enter the root password for all other root activities. Is there a way to prevent the password entry for this command only and no others?

View 3 Replies View Related

General :: Trying Sudo MV Command On File - Permission Denied

Jul 17, 2010

If I try the sudo mv command on the file listed below I get the error listed. I am confused. It is my file & I have permissions. Somehow a slew of files on my system are now showing this way. This seems to correspond when I ran rsync from my netbook to sync it up with my desktop where I am having a problem.

Potential Source ->
sudo rsync -av --delete --rsh=ssh joe@192.168.1.4:/media/Abyss/Memories/ /home/joe/Pictures/

Type of issue ->
mv: cannot remove `100_2259.jpg': Permission denied

joe@Tux-Box:/media/Abyss/Memories/2009/3-09$ stat 100_2259.jpg
File: `100_2259.jpg'
Size: 243012 Blocks: 480 IO Block: 4096 regular file
Device: 811h/2065dInode: 1312030 Links: 1
Access: (0777/-rwxrwxrwx) Uid: (1000/joe) Gid: (1000/joe)
Access: 2010-07-17 11:41:26.708020712 -0400
Modify: 2009-12-13 21:49:59.501938000 -0500
Change: 2009-12-24 05:54:02.854309200 -0500

View 7 Replies View Related

General :: Specify Password For Sudo Command When Running Bg Process?

Jun 23, 2010

I'd like to start a background job using the sudo command and route its output to a file. This presents a problem because the prompt for the password doesn't work properly. It looks something like this when I try it:

Code:
Mac:server user$ sudo php crossdomain_server.php > data/crosscomain_output.txt &
[3] 30303
Mac:server user$ Password:
[3]+ Stopped sudo php crossdomain_server.php > data/crosscomain_output.txt
Mac:server user$

Basically I'm not properly prompted for the password and as soon as I type anything in my background job fails because it didn't receive the password. Is there any way to execute a sudo command by supplying the password on the same line as the command?

View 9 Replies View Related

General :: Sudo Aptitude Update Command Not Found?

May 7, 2011

trying to get wine working was reading the tutorial-

"Complete Guide to Using Wine from the Command Line (Ubuntu)" first thing it said to do for ubuntu user's was this-

"Before I continue with my rant about gaming on Linux I would like to point out right now that the very first thing you should do when you install your ubuntu set up is to run the following:

Code:
user@ubuntu$ sudo aptitude update
user@ubuntu$ sudo aptitude install ubuntu-restricted-extras

but when i try and run in the terminal i get "command not found".

using ubuntu 11.4 natty kernel linux 2.6.38-8 generic gnome 2.32.1

View 5 Replies View Related

Server :: Sudo - Command Can't Run By Sudo

Jun 18, 2010

I am having trouble running commands by using sudo. I configured visudo file with localuser ALL=(ALL) ALL but I can't run any command, it tells me command not found.

View 8 Replies View Related

General :: Sudo And Command Line - Get The Result Without Having To Supply A Password

Mar 31, 2011

I have the following commande /sbin/fuser -f -u /u/DT01/F010107 1>/tmp/null 2>/tmp/seausr.T0069 when executing as root 'su' this give me all user using the file. but when tried with 'sudo' i am asked with 'user password'. Is ther anyway to simply get the result without having to supply a password and to see all user not only me. (i have the file open also).

View 1 Replies View Related

General :: Sudo Command Occasionally Asks For Root Password?

Sep 9, 2010

In Ubuntu 10.04, I logged in as user1 and when I open a new terminal and issue any command it is asking password.user@ubun-laptop:~$ sudo ifconfig[sudo] password for user: It is asking for password only for first time.From the next command onwards it is not asking.Can some one please tell me if it is possible to issue ONLY ONE COMMAND, in which even if the password request comes, it will automatically fill the password.Just like "ps -elf | grep NetworkManager". I am expecting any combination of commands in a single line, so that password is filled automatically IF PASSWORD IS ASKED. If password is not asked, the command must be executed.

View 17 Replies View Related

General :: What Is Difference Between Power Broker Utility And Sudo Command

Aug 11, 2011

I just wanted to know the difference between Using Sudo mechanism over using Power breaker utilities.

View 4 Replies View Related

General :: BashSR File Edited Wrongly - Sudo Command Not Found

Sep 20, 2010

I had edited the bashsr file wrongly in my ubuntu while trying to put a "export" command in bashsr for javac. Next when i am writing sudo , its saying :
Command 'sudo' is available in '/usr/bin/sudo'
The command could not be located because '/usr/bin' is not included in the PATH environment variable. sudo: command not found

View 3 Replies View Related

General :: Setup A System To Allow Normal Users To Execute A Command Without Using Sudo?

Jan 5, 2011

I am trying to setup a system to allow normal users to execute a command without using sudo. Is this possible?

View 6 Replies View Related

General :: When Type - Sudo Grub - It Says - Command Not Found" In Ubuntu 9.10 Live CD

Jan 30, 2010

I am going to reinstall my GRUB bootloader and some one said do the followings:

But when I type "sudo grub" in terminal it gives this error: "sudo: grub: command not found"

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved