nixCraft Linux / UNIX / Shell Scripting Forum

nixCraft

Linux / UNIX Tech Support Forum

su -c

This is a discussion on su -c within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; hi am a newbie on Linux.. we're testing a centos5.3 server edition here.. i saw a syntax on net to ...


Register free or login to your account to remove all advertisements.

Go Back   nixCraft Linux / UNIX / Shell Scripting Forum > Linux Distribution > CentOS / RHEL / Fedora

Linux answers from nixCraft.


CentOS / RHEL / Fedora Discussion about Redhat Enterprise Linux or CentOS or Fedora Linux related problems.

Reply

 

Thread Tools Display Modes
  #1 (permalink)  
Old 17th November 2009, 01:22 PM
Junior Member
 
Join Date: Nov 2009
OS: CENTOS
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
schizo is on a distinguished road
Default su -c

hi am a newbie on Linux.. we're testing a centos5.3 server edition here.. i saw a syntax on net to use [su -c yum ....]
my question is... what does "-c" means..
hope for your patience if i seem to be so dumb.. as i ve said.. am a newbie.. thank you.
Reply With Quote
  #2 (permalink)  
Old 17th November 2009, 02:46 PM
Junior Member
 
Join Date: Nov 2009
OS: CentOS
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
harshana is on a distinguished road
Default

Using "-c" option with "su" you can pass a single COMMAND to the shell.

You can use --command=COMMAND as well.

Last edited by harshana; 17th November 2009 at 02:50 PM.
Reply With Quote
  #3 (permalink)  
Old 18th November 2009, 10:13 AM
Junior Member
 
Join Date: Nov 2009
OS: CENTOS
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
schizo is on a distinguished road
Talking elaborate pls...

pass single command to shell??? d'u mean only one command at a time.. ???
on a centos5.3 server, within the user X , i tried
yum update > u need to be root to perform this command
sudo 'yum update' > prompted a password.
root password -not valid.
with X password- X is not in the sudoers file......
su - root 'yum update' > -bash: yum update: no such file or directory
su -c 'yum update' - it worked

can u explain the result of each command i tried? again thank you for the patience..
Reply With Quote
  #4 (permalink)  
Old 18th November 2009, 12:11 PM
Junior Member
 
Join Date: Nov 2009
OS: CentOS
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
harshana is on a distinguished road
Default

Yes,
to use SUDO you have to configure it for user X,

here what you doing is running 'yum update' command as super user use of su -C,

instead of that you can simply login to root(super user) by using "su" and run "yum update"

ex:

#su
password :

#yum update
Reply With Quote
  #5 (permalink)  
Old 18th November 2009, 12:40 PM
Junior Member
 
Join Date: Nov 2009
OS: CENTOS
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
schizo is on a distinguished road
Smile thank you...

nice one..

................ youll be reading more next time...

i still have to reformat and reinstall centos in order for me to learn the "partitioning part" then configure it.. what packages to install and update...

it would be helpful for me if ul suggest a nice site to read...

hope for u 2 drop by and check on my posts every now and then..

Reply With Quote
Reply

Tags
centos, linux su -c run command, rhel, rhel su -c, rhel5, su command, su run command


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT +5.5. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.6 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40