• User Management
  • | Chapter 1: Foundations of Kali Linux




    Download 22,59 Mb.
    Pdf ko'rish
    bet30/225
    Sana14.05.2024
    Hajmi22,59 Mb.
    #232856
    1   ...   26   27   28   29   30   31   32   33   ...   225
    Bog'liq
    learningkalilinux

    24 | Chapter 1: Foundations of Kali Linux


    Each of these streams can be redirected. Normally, STDOUT and STDERR go to the
    same place (typically, the console). STDIN originates from the console. If you want
    your output to go somewhere else, you can use the 
    >
    operator. If, for instance, I
    wanted to send the output of 
    ps
    to a file, I might use 
    ps auxw > ps.out
    . When you
    redirect the output, you don’t see it on the console anymore. In this example, if there
    were an error, you would see that, but not anything going to STDOUT. If you wanted
    to redirect input, you would go the other way. Rather than 
    >
    , you would use 
    <
    , indi‐
    cating the direction you want the information to flow.
    Understanding the different I/O streams and redirection will help you down the path
    of understanding the 
    |
    (pipe) operator. When you use 
    |
    , you are saying, “Take the out‐
    put from what’s on the left side and send it to the input for what’s on the right side.”
    You are effectively putting a coupler in place between two applications, STDOUT →
    STDIN, without having to go through any intermediary devices.
    One of the most useful uses of command chaining or piping is for searching or filter‐
    ing. As an example, if you have a long list of processes from the 
    ps
    command, you
    might use the pipe operator to send the output of 
    ps
    to another program, 
    grep
    , which
    can be used to search for strings. As an example, if you want to find all the instances
    of the program named 
    httpd
    , you use 
    ps auxw | grep httpd

    grep
    is used to search an
    input stream for a search string. While it’s useful for filtering information, you can
    also search the contents of files with 
    grep
    . As an example, if you want to search for the
    string 
    wubble
    in all the files in a directory, you can use 
    grep wubble *
    . If you want to
    make sure that the search follows all the directories, you tell 
    grep
    to use a recursive
    search with 
    grep -R wubble *
    .
    User Management
    When you start up Kali, you have the root user in place. Unlike other Linux distribu‐
    tions, you won’t be asked to create another user. This is because much of what you
    may be doing in Kali will require superuser (root) permissions. As a result, there’s no
    reason to create another user, even though it’s not good practice to stay logged in as
    the root user. The expectation is that someone using Kali probably knows enough of
    what they are doing that they wouldn’t be as likely to shoot themselves in the foot
    with the root permissions.
    However, it is still possible to add and otherwise manage users in Kali, just as it is
    with other distributions. If you want to create a user, you can just use the 
    useradd
    command. You might also use 
    adduser
    . Both accomplish the same goal. When you
    are creating users, it’s useful to understand some of the characteristics of users. Each
    user should have a home directory, a shell, a username, and a group at a minimum. If
    I want to add my common username, for instance, I would use 
    useradd -d /home/
    kilroy -s /bin/bash -g users -m kilroy
    . The parameters given specify the home directory,
    the shell the user should execute when logging in interactively, and the default group.

    Download 22,59 Mb.
    1   ...   26   27   28   29   30   31   32   33   ...   225




    Download 22,59 Mb.
    Pdf ko'rish