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

Thread: how to enable bash history for users?

  1. #1

    Default how to enable bash history for users?

    Peace, when I execute a command as a user, it appears when I press the up arrow. But when i exit from the user and su again, the up arrow display zilch. There is no such problem in gentoo.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,171

    Default Re: how to enable bash history for users?

    Hello and welcome here.

    Please be a bit more descriptive (or better, show it).

    You say "when I exit from the user", but then there is no session. Then you say "and su again" but there is no session to do any "su" command in, nor was there any "su" in your description earlier, thus why the "again"?

    Confusing to me.

    Oh, and allow me, you being new here:

    There is an important, but not easy to find feature on the forums.

    Please use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.
    Henk van Velden

  3. #3
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,134

    Default Re: how to enable bash history for users?

    Only guessing (see Henke's comments) but have you read the man page for su or tried “su --help”. To switch to the target user's environment you have to:
    Code:
     user1: > su - user2
    Also if user2 has multiple logins, only the last to logout's history is preserved, and command-lines that start with white-space are not saved in history.
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  4. #4

    Default Re: how to enable bash history for users?

    Code:
    su - kadish
    did not help. after executing some commands and exiting and then su'ing again, history is null. the history is only on root.

  5. #5

    Default Re: how to enable bash history for users?

    ok, the problem that /home/kadish did not exist, once created history works, or is it that I tried the new command without exiting from su without "-"...

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,171

    Default Re: how to enable bash history for users?

    I have no idea what you are trying to tell. Please SHOW by copy/paste instead of telling vague stories.

    Do you have a problem or are you trying to tell that it is solved?
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,868
    Blog Entries
    14

    Default Re: how to enable bash history for users?

    Quote Originally Posted by majed17 View Post
    ok, the problem that /home/kadish did not exist, once created history works, or is it that I tried the new command without exiting from su without "-"...
    No, just think about this question: How would the system store used commands in ~/.bash_history if ~/ doesn't even exist? You've already seen the answer to this question.

    BTW: new here? Welcome !!
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,171

    Default Re: how to enable bash history for users?

    Quote Originally Posted by Knurpht View Post
    No, just think about this question: How would the system store used commands in ~/.bash_history if ~/ doesn't even exist? You've already seen the answer to this question.

    BTW: new here? Welcome !!
    Do you think he really means he is/was having a user without a home directory?
    Henk van Velden

  9. #9
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,134

    Default Re: how to enable bash history for users?

    Unless you show us what you are doing and what happens as was explained before, you reduce us to guessing and wasting our time. Your initial post never mentioned root. You also did not show how you created the user “kadesh”. (YaST or useradd -m). If you had shown your working the answer would have been apparent.

    Apologies, I am tired and crabbit.
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  10. #10
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,868
    Blog Entries
    14

    Default Re: how to enable bash history for users?

    Quote Originally Posted by hcvv View Post
    Do you think he really means he is/was having a user without a home directory?
    I don't only think so, see
    ok, the problem that /home/kadish did not exist, once created history works, or is it that I tried the new command without exiting from su without "-"...
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

Page 1 of 2 12 LastLast

Posting Permissions

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