LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-01-2009, 05:38 PM   #1
gerryd
LQ Newbie
 
Registered: Jul 2009
Distribution: slackware 13
Posts: 21

Rep: Reputation: 1
no output for fdisk -l


when i'm not logged in as root i get no output when running fdisk. i can't even find the command without giving the absolute path
Code:
/sbin/fdisk -l
can anyone tell me why this happens? and if i can change it? thanks.
oh, and i'm using slackware 13 if that helps at all.
 
Old 10-01-2009, 05:52 PM   #2
slimg00dy
LQ Newbie
 
Registered: Oct 2009
Posts: 26

Rep: Reputation: 2
Use sudo fdisk -l

Or login as root with su

If you want your account to be in the sudoers so you can just use sudo fdisk -l do
echo 'usernamehere ALL=(ALL) ALL
 
Old 10-01-2009, 05:54 PM   #3
waltuotinen
LQ Newbie
 
Registered: Oct 2009
Location: Clifton, NJ USA
Posts: 6

Rep: Reputation: 2
fdisk -l not found

If the first word on a command line, which is almost always a command, does not contain any "/" characters, your shell tries to find the command you're trying to run.

To do this (unless the command is a built-in, an alias or a defined function), the shell searches the directories that are contained in your PATH variable, which usually has a list of one or more directory pathnames seperated by ":".

You can view your current PATH by entering:
echo $PATH

It will include /bin and or /usr/bin, but not /sbin.

If you enter:
PATH=$PATH:/sbin
you can then run fdisk -l without having to qualify its location.

To make this change to the PATH variable permanent, edit the .profile file in your home directory and add that same line of code (PATH=$PATH:/sbin) somewhere in the file, then the next time you log in, you'll be able to run any of the commands in /sbin without having to tell the shell where to find them.

I'm not sure, though, why the output is blank. I'll boot up my Linux laptop and check it out.

Best regards,
Walt Uotinen
 
Old 10-01-2009, 06:09 PM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello together,

you'll need root-permissions to get an output for the command and you'll have to take the full path since /sbin is not in the path for a normal user.
Code:
sudo /sbin/fdisk -l
will work.

Markus

Edit: in Slackware, if you have not configured sudo just try
Code:
su -c /sbin/fdisk -l

Last edited by markush; 10-01-2009 at 06:11 PM.
 
Old 10-01-2009, 06:17 PM   #5
waltuotinen
LQ Newbie
 
Registered: Oct 2009
Location: Clifton, NJ USA
Posts: 6

Rep: Reputation: 2
no output for fdisk -l

One other way to get fdisk to give you output without using sudo or becoming root (with su):

Become root, then enter:
chmod u+s /sbin/fdisk

This enables the Set User Id bit on the executable, so anyone can run fdisk and the process will have an effective user id of 0, indicating that root is running it.

A word of caution, though, that will allow anyone to use fdisk, albeit they'll have to run /sbin/fdisk, but it can do far more than just produce reports. It can reformat a disk...

Best regards,
Walt Uotinen

Last edited by waltuotinen; 10-01-2009 at 06:22 PM.
 
Old 10-01-2009, 06:31 PM   #6
sploot
Member
 
Registered: Sep 2009
Location: Phoenix, AZ
Distribution: Gentoo, Debian, Ubuntu
Posts: 121

Rep: Reputation: 27
Quote:
Originally Posted by waltuotinen View Post
Become root, then enter:
chmod u+s /sbin/fdisk
Don't do this if any other person might ever have access to your computer. Use sudo. log into the root user. dont give such huge system access to all users if you have any expectation of your computer surviving other people's use.

Easiest way, set up sudo. Configure it so you can use it and it will null your authentication after 30 seconds or so. Keep it secure
 
Old 10-01-2009, 06:45 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
sbin = system binaries; those usually only needed by root(!) user.
http://en.wikipedia.org/wiki/Filesys...archy_Standard
 
  


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
fdisk -l produces no output jakubi Debian 13 03-02-2011 10:50 AM
fdisk and tail result in no output ubume2 Ubuntu 1 05-07-2008 05:47 AM
Partition error - Different FDISK and YaST output Jongi SUSE / openSUSE 8 11-26-2005 07:42 PM
fdisk -l has stopped giving output Bruce Hill Slackware 59 09-06-2004 09:14 AM
fdisk -l output? hank43 Linux - General 3 03-07-2004 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:55 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