Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to Find Root

  1. #1
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Beans
    864
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Question How to Find Root

    Hi All,

    How can we find if we are being in root user mode?

    What are the possible ways to determine this?
    Like

    1) find -name su

    Please let me know.

    Thanks in advance.
    "Those Who Can, Will Finish It.
    Those Who Can't Will Justify/Complain the reasons."

  2. #2
    Join Date
    Aug 2012
    Location
    Hong Kong
    Beans
    160
    Distro
    Ubuntu Development Release

    Re: How to Find Root

    We don't recommend you to use root, since sometimes if you did anything in root you'll end up damaging your system.
    Last edited by nothingspecial; August 16th, 2012 at 11:22 AM.

  3. #3
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,648
    Distro
    Ubuntu

    Re: How to Find Root

    Quote Originally Posted by smartboyhw View Post
    sudo -passwd root.

    However, we don't recommend you to use root, since sometimes if you did anything in root you'll end up damaging your system.
    In ubuntu the root account is disabled. sudo is used instead. Read this

    https://help.ubuntu.com/community/RootSudo

    When giving advice on the Ubuntu Forms and IRC, please take the time to teach "the basics" such as ownership, permissions, and how to use sudo / gksu / kdesudo in such a way that new users do not break systems.

  4. #4
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Beans
    864
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: How to Find Root

    Hi, Thanks you all...

    But my question is

    "How can we find if we are being in root user mode?"
    "Those Who Can, Will Finish It.
    Those Who Can't Will Justify/Complain the reasons."

  5. #5
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: How to Find Root

    If you're in a terminal
    hob@sidh:~$

    with root

    root@sidh:~#
    Forum Social IRC Channel
    Xubuntu IRC Support
    Xubuntu Support

    Please do not PM me about Registration issues without having been asked to. I will tell you to post here

  6. #6
    Join Date
    Nov 2008
    Location
    Lleida, Spain
    Beans
    1,157
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to Find Root

    type whoami

    For example:
    if I type whoami, it says:
    albandy
    but if I type sudo whoami, it says:
    root

  7. #7
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Beans
    864
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: How to Find Root

    Yes. All of this can be done, by visually checking.
    That is by a human.
    How can we automate it or tell the machine via a program or script?
    Or I should inform the user, if they are root or a normal user, by checking something in the current user privileges.

    Thanks.
    "Those Who Can, Will Finish It.
    Those Who Can't Will Justify/Complain the reasons."

  8. #8
    Join Date
    Aug 2012
    Location
    Hong Kong
    Beans
    160
    Distro
    Ubuntu Development Release

    Re: How to Find Root

    Quote Originally Posted by rraj.be View Post
    Yes. All of this can be done, by visually checking.
    That is by a human.
    How can we automate it or tell the machine via a program or script?
    Or I should inform the user, if they are root or a normal user, by checking something in the current user privileges.

    Thanks.
    I think the last option is the best.

  9. #9
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Beans
    864
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: How to Find Root

    One more thing i have found is

    Code:
    id
    This will give the uid of current user like

    Code:
    root@rraj-ubuntu:/home/rraj# id
    uid=0(root) gid=0(root) groups=0(root)
    root@rraj-ubuntu:/home/rraj#
    "Those Who Can, Will Finish It.
    Those Who Can't Will Justify/Complain the reasons."

  10. #10
    Join Date
    Nov 2008
    Location
    Lleida, Spain
    Beans
    1,157
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to Find Root

    Quote Originally Posted by rraj.be View Post
    Yes. All of this can be done, by visually checking.
    That is by a human.
    How can we automate it or tell the machine via a program or script?
    Or I should inform the user, if they are root or a normal user, by checking something in the current user privileges.

    Thanks.
    Script example to ensure you're running under root.
    Code:
    #! /bin/bash
    
    if [ "$(whoami)" != "root" ]
    then
    echo "you must be root"
    exit 1
    fi
    
    #commands to run under root
    echo "OK running under root"
    #type the commands to run under root.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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