Join the community today
Register Now

ssh commands not logged for the current session

Discussion in 'System Administration' started by pamamolf, Jul 21, 2014.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,084
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    10:43 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hi

    Is it possible when i login on the ssh and run some commands to not be logged at all?

    I don't want to delete logs at the end as i do not want to get clear the previous ssh commands.....


    Just to run them and not get logged !

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,647
    12,230
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,799
    Local Time:
    6:43 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. pamamolf

    pamamolf Premium Member Premium Member

    4,084
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    10:43 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Great but is this only per session and if i close the ssh window it will be ok again?
    Or i must disable it at the end and how?

    Thanks !!!
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,647
    12,230
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,799
    Local Time:
    6:43 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Should be able to do that by adding the entire export command listed in 10th listing to your /root/.bash_profile file then log out of SSH and back in
     
  5. Matt

    Matt Well-Known Member

    932
    415
    63
    May 25, 2014
    Rotherham, UK
    Ratings:
    +671
    Local Time:
    8:43 AM
    1.5.15
    MariaDB 10.2
    any reason why you don't want your commands to be logged? I find having them logged invaluable, and just leave it at the 1,000 limit. Being able to look over the commands I've entered when troubleshooting why something isn't working right have saved me quite a few times over the years.
     
  6. pamamolf

    pamamolf Premium Member Premium Member

    4,084
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    10:43 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Confused :(

    If i add the export command on the bash profile i can't see how is this disabling that feature ....

    I was thinking just to login and run from ssh:

    export HISTCONTROL=ignorespace

    and then run my commands from ssh with a space in front of every command.....

    Then after running the commands if i just close the ssh window and i am asking if that export HISTCONTROL=ignorespace is still there so if i login again after a day i will run again commands without to get logged using the space in front of every command?

    If yes ho can i disable it permanent ?

    Thanks !
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,647
    12,230
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,799
    Local Time:
    6:43 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    adding it to bash_profile enables it permanently as it's called and run when you login everytime

    but as Matt said, it's useful to troubleshoot problems to have a full history of commands
     
  8. pamamolf

    pamamolf Premium Member Premium Member

    4,084
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    10:43 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Yes but i am aksing if i do not add it on bash and i close the ssh window after finishing with my commands this option will stay active for my next login or not?
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,647
    12,230
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,799
    Local Time:
    6:43 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+