Get the most out of your Centmin Mod LEMP stack
Become a Member

ssh commands not logged for the current session

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

  1. pamamolf

    pamamolf Well-Known Member

    2,539
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    1:33 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:33 PM
    Nginx 1.13.x
    MariaDB 5.5
  3. pamamolf

    pamamolf Well-Known Member

    2,539
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    1:33 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:33 PM
    Nginx 1.13.x
    MariaDB 5.5
    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 Moderator Staff Member

    680
    314
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +433
    Local Time:
    11:33 AM
    1.7.1
    MariaDB 10
    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 Well-Known Member

    2,539
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    1:33 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:33 PM
    Nginx 1.13.x
    MariaDB 5.5
    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 Well-Known Member

    2,539
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    1:33 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:33 PM
    Nginx 1.13.x
    MariaDB 5.5