LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-29-2009, 02:27 PM   #1
fantasygoat
Member
 
Registered: Sep 2009
Posts: 119

Rep: Reputation: 17
sudo fails - "sudo: can't get hostname: Success"


I have a server (CentOS 5.3) which won't allow the sudo command to work, and it fails with the following error:

Quote:
sudo: can't get hostname: Success
The issue is probably the hostname, which is quite long - so long, that the hostname command cuts it off.

Is there a way to set sudo to not require a hostname? I've tried putting the hostname in /etc/hosts without any luck. Unfortunately I cannot change the hostname to something shorter due to the system in place so I need to find a workaround.

Thanks!
 
Old 09-30-2009, 02:23 AM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
What are you trying to accomplish with "sudo" ?

Are you trying to sudo to a shell, or run a single
specific command?

How long is the hostname, itself, not counting any
characters that make up a domain name, etc. For
example, if the host were on the Internet and it's
complete name was:

"myhost.here.there.everywhere.com"

then the portion of the name that I'm concerned with
would be just "myhost", so it would be only 6
characters. How long is the portion of your hosts
fully qualified name, before the first dot?
 
Old 10-01-2009, 09:47 AM   #3
fantasygoat
Member
 
Registered: Sep 2009
Posts: 119

Original Poster
Rep: Reputation: 17
I am trying to run commands as root.

The hostnames in question are 68-70 characters in length. It's set up to like:

x.type-version-subtype-customer-office.interface.environment.branch.domain.name

Don't ask me why they do this, it was the logic they decided on and I have to live with it.
 
Old 10-01-2009, 02:59 PM   #4
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
If you have a full blown sudoers implementation
then in principle it should allow the use of a
host alias, the value of which can be an IP address.
If the problem is the hostname, that might solve your
problem. However, there's two aspects to hostname
here. I realize you're making substitutions in the
"pattern" of the hostname that you illustrated, so
just in terms of the pattern tokens, if you're
using the pattern you mentioned:

x.type-version-subtype-customer-office.interface.environment.branch.domain.name

the command:

hostname -s

should output the portion of the name represented
by the first token "x", whereas the command


hostname --fqdn

should output the entire name. For the first portion,
some linux facilities only allow it to be as much as
32 characters, whereas some others 64 characters, and
for the full name, 256 characters.

Hope this helps.
 
  


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
Getting error "sudo: unable to execute ./setup: Success" d_girish_d Linux - Software 3 07-20-2009 11:33 PM
sudo fails due to hostname edgjerp Ubuntu 6 05-05-2008 12:51 AM
cannot "sudo apt-get uptate" or "sudo" anything! plz help mdguy21061 Linux - Newbie 7 04-13-2008 11:59 PM
"sudo -u user ssh server" fails to connect oudoubah Linux - Security 3 06-21-2007 06:45 AM
how do I get around the "submit passwd" prompt in ubuntu even if I use "sudo"? t3gah Linux - Distributions 1 02-22-2005 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:22 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
Open Source Consulting | Domain Registration