Find the answer to your Linux question:
Results 1 to 9 of 9
I checked .bashrc and .bash_profile for the root account and my personal account and the PATH seems to be identical. However, When I run a command such as fdisk under ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416

    bash question


    I checked .bashrc and .bash_profile for the root account and my personal account and the PATH seems to be identical.
    However, When I run a command such as fdisk under my account I get 'Command not found' while it works fine for root.

    Is this a permission thing? In FreeBSD it usually tells me that I don't have permissions. What's the deal here?

  2. #2
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    I think 'fdisk' is under /sbin/fdisk. Since I'm not in linux, I can't tell you where it is but run 'which fdisk'. Once you get the path, use 'ls -l <path>' to see the permissions on it. I'm very sure that the permission is set for root to execute this program.
    The best things in life are free.

  3. #3
    Linux User
    Join Date
    May 2003
    Location
    CA
    Posts
    370
    fsidk is under /sbin/fdisk
    if u try to run it as a normal user you'll get the error message
    "Cannot open <device>"
    you'll haveto run it as root

  4. #4
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Right so run 'ls -l /sbin/fdisk' This will then give you a long list of the file along with the permissions, date of last modification, and etc. You guys do know how to read permissions don't you?
    The best things in life are free.

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    It's no wodner that you found no difference in root's .bash* files. The */sbin dirs are added to the PATH in /etc/profile.
    So as a user, either, as has been suggested, run /sbin/fdisk, or do as I have done, add */sbin to your PATH as your user login as well (there you can use the .bash* files, preferably .bash_profile).

  6. #6
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416
    That explains it. Is this just a Linux thing? I don't think it works like that in FreeBSD

    cheers

  7. #7
    Linux Newbie
    Join Date
    Apr 2003
    Location
    UK, Manchester
    Posts
    147
    I think its more of a common sense thing.
    Why would you want normal users to have access to /sbin or /usr/local/sbin.
    Only root should be able to run/access those commands.

  8. #8
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    What did you mean that it was that wouldn't be possible in BSD?

  9. #9
    Linux User Allblack's Avatar
    Join Date
    May 2003
    Location
    Godzone
    Posts
    416
    What I meant was that on my freeBSD box, when I create a user and give him the bash shell there appear a lot more directories under PATH than there are in my bash file on RH

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •