Is it possible to log out of Chrome using the command line?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Google's Chrome browser (and Chromium) stores the saved passwords in a encrypted sqlite database where it is pretty safe. However, if the user is logged into Chrome, it is merely a matter of a few mouse clicks to reveal the passwords.



Because of that I would like to make a script that will automatically log me out of Chrome based on certain criteria, such as when my Linux PC is connected to a foreign network (which would be the case if it were stolen).



The script itself is not my main problem. What I don't know, however, is how to force Chrome to log me out using the command line.



Is that possible?










share|improve this question


















  • 1





    It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

    – wersimmon
    Sep 23 '13 at 22:43











  • It is part of the answer. There are more safety precautions such as a encrypted home folder.

    – marlar
    Sep 24 '13 at 7:35




















1















Google's Chrome browser (and Chromium) stores the saved passwords in a encrypted sqlite database where it is pretty safe. However, if the user is logged into Chrome, it is merely a matter of a few mouse clicks to reveal the passwords.



Because of that I would like to make a script that will automatically log me out of Chrome based on certain criteria, such as when my Linux PC is connected to a foreign network (which would be the case if it were stolen).



The script itself is not my main problem. What I don't know, however, is how to force Chrome to log me out using the command line.



Is that possible?










share|improve this question


















  • 1





    It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

    – wersimmon
    Sep 23 '13 at 22:43











  • It is part of the answer. There are more safety precautions such as a encrypted home folder.

    – marlar
    Sep 24 '13 at 7:35
















1












1








1








Google's Chrome browser (and Chromium) stores the saved passwords in a encrypted sqlite database where it is pretty safe. However, if the user is logged into Chrome, it is merely a matter of a few mouse clicks to reveal the passwords.



Because of that I would like to make a script that will automatically log me out of Chrome based on certain criteria, such as when my Linux PC is connected to a foreign network (which would be the case if it were stolen).



The script itself is not my main problem. What I don't know, however, is how to force Chrome to log me out using the command line.



Is that possible?










share|improve this question














Google's Chrome browser (and Chromium) stores the saved passwords in a encrypted sqlite database where it is pretty safe. However, if the user is logged into Chrome, it is merely a matter of a few mouse clicks to reveal the passwords.



Because of that I would like to make a script that will automatically log me out of Chrome based on certain criteria, such as when my Linux PC is connected to a foreign network (which would be the case if it were stolen).



The script itself is not my main problem. What I don't know, however, is how to force Chrome to log me out using the command line.



Is that possible?







linux command-line google-chrome






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 23 '13 at 21:49









marlarmarlar

294514




294514








  • 1





    It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

    – wersimmon
    Sep 23 '13 at 22:43











  • It is part of the answer. There are more safety precautions such as a encrypted home folder.

    – marlar
    Sep 24 '13 at 7:35
















  • 1





    It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

    – wersimmon
    Sep 23 '13 at 22:43











  • It is part of the answer. There are more safety precautions such as a encrypted home folder.

    – marlar
    Sep 24 '13 at 7:35










1




1





It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

– wersimmon
Sep 23 '13 at 22:43





It sounds like you want to avoid losing all your passwords if your computer ever gets stolen. Logging out of Chrome isn't the answer to this.

– wersimmon
Sep 23 '13 at 22:43













It is part of the answer. There are more safety precautions such as a encrypted home folder.

– marlar
Sep 24 '13 at 7:35







It is part of the answer. There are more safety precautions such as a encrypted home folder.

– marlar
Sep 24 '13 at 7:35












3 Answers
3






active

oldest

votes


















3














You should consider other more general security measures to protect the data of a running or suspended system:




  • (automatically) lock your sessions when away from keyboard,

  • encrypt your home directory or partition,

  • encrypt the suspend image (dm-crypt, uswsusp, or tuxonice will do the job),

  • encrypt the swap partition (dm-crypt), and

  • use one or multiple strong pass phrases or even a smartcard in all of the above instances.


At this point it doesn't matter much, if the browser still has the master key in memory.



Rationale



If someone steals your notebook, he would have to guess your key, break the encryption, or analyse the memory content in case of a live system. The latter two are considered very difficult to achieve, whereas the difficulty of the first depends on the complexity of your key.






share|improve this answer

































    1














    use an external password program that can be set up with requiring a passcode generated by an app on your smartphone, or that can send a text with a one time password to access their database. My personal preference is LastPass.



    pkill can be used to kill off processes - if you set up chrome to not remember your login details when starting a new session, this would be sufficient (settings > content settings > manage exceptions > add pattern: google.com > dropdown: clear on exit)






    share|improve this answer































      1














      Just posting this because I couldn't find the answer...
      The trick is all about https://mail.google.com/mail/?logout&hl=en which logs you out.



      For Conf room machines that may be left logged in and are set to always be running.



      Create a bash file called LogOutOfChome.sh in ~/ with contents:



      #!/bin/bash
      PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

      pkill -a -i "Google Chrome"
      sleep 3
      Open -a "/Applications/Google Chrome.app" --args 'https://mail.google.com/mail/?logout&hl=en'
      sleep 15
      pkill -a -i "Google Chrome"


      This kills all open instances of Chrome, waits 3 seconds, opens the Gmail logout URL, waits 15 seconds, then kills all instances of Chrome again.



      From the terminal:
      chmod +x LogOutOfChrome.sh,
      which will make it executable.



      Test it (note, this will close all your Chrome windows and log you out…..)
      ./LogOutOfChrome.sh



      Use crontab to schedule it.
      crontab -l (this is a lower case L)
      to list if you have anything else scheduled.

      Edit your crontab with VI.
      crontab -e

      Type i (lower case I) to insert

      Copy/Paste:



      *   1   *   *   *   ~/LogOutOfChrome.sh


      Hit Esc, enter :wqEnter
      to Write and Quit. 
      This will run the script at (minute, hour, day month, day of week) at hour 1
      (i.e., 1 AM) of each day.



      To test this, if it was currently 2:15pm set it to:



      17  14  *   *   *   ~LogOutOfChrome.sh


      which is 17 minutes past 14:00 hours (i.e., 2:17 PM).






      share|improve this answer


























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "3"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f649370%2fis-it-possible-to-log-out-of-chrome-using-the-command-line%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3














        You should consider other more general security measures to protect the data of a running or suspended system:




        • (automatically) lock your sessions when away from keyboard,

        • encrypt your home directory or partition,

        • encrypt the suspend image (dm-crypt, uswsusp, or tuxonice will do the job),

        • encrypt the swap partition (dm-crypt), and

        • use one or multiple strong pass phrases or even a smartcard in all of the above instances.


        At this point it doesn't matter much, if the browser still has the master key in memory.



        Rationale



        If someone steals your notebook, he would have to guess your key, break the encryption, or analyse the memory content in case of a live system. The latter two are considered very difficult to achieve, whereas the difficulty of the first depends on the complexity of your key.






        share|improve this answer






























          3














          You should consider other more general security measures to protect the data of a running or suspended system:




          • (automatically) lock your sessions when away from keyboard,

          • encrypt your home directory or partition,

          • encrypt the suspend image (dm-crypt, uswsusp, or tuxonice will do the job),

          • encrypt the swap partition (dm-crypt), and

          • use one or multiple strong pass phrases or even a smartcard in all of the above instances.


          At this point it doesn't matter much, if the browser still has the master key in memory.



          Rationale



          If someone steals your notebook, he would have to guess your key, break the encryption, or analyse the memory content in case of a live system. The latter two are considered very difficult to achieve, whereas the difficulty of the first depends on the complexity of your key.






          share|improve this answer




























            3












            3








            3







            You should consider other more general security measures to protect the data of a running or suspended system:




            • (automatically) lock your sessions when away from keyboard,

            • encrypt your home directory or partition,

            • encrypt the suspend image (dm-crypt, uswsusp, or tuxonice will do the job),

            • encrypt the swap partition (dm-crypt), and

            • use one or multiple strong pass phrases or even a smartcard in all of the above instances.


            At this point it doesn't matter much, if the browser still has the master key in memory.



            Rationale



            If someone steals your notebook, he would have to guess your key, break the encryption, or analyse the memory content in case of a live system. The latter two are considered very difficult to achieve, whereas the difficulty of the first depends on the complexity of your key.






            share|improve this answer















            You should consider other more general security measures to protect the data of a running or suspended system:




            • (automatically) lock your sessions when away from keyboard,

            • encrypt your home directory or partition,

            • encrypt the suspend image (dm-crypt, uswsusp, or tuxonice will do the job),

            • encrypt the swap partition (dm-crypt), and

            • use one or multiple strong pass phrases or even a smartcard in all of the above instances.


            At this point it doesn't matter much, if the browser still has the master key in memory.



            Rationale



            If someone steals your notebook, he would have to guess your key, break the encryption, or analyse the memory content in case of a live system. The latter two are considered very difficult to achieve, whereas the difficulty of the first depends on the complexity of your key.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 24 '13 at 16:34

























            answered Sep 24 '13 at 15:41









            David FoersterDavid Foerster

            811515




            811515

























                1














                use an external password program that can be set up with requiring a passcode generated by an app on your smartphone, or that can send a text with a one time password to access their database. My personal preference is LastPass.



                pkill can be used to kill off processes - if you set up chrome to not remember your login details when starting a new session, this would be sufficient (settings > content settings > manage exceptions > add pattern: google.com > dropdown: clear on exit)






                share|improve this answer




























                  1














                  use an external password program that can be set up with requiring a passcode generated by an app on your smartphone, or that can send a text with a one time password to access their database. My personal preference is LastPass.



                  pkill can be used to kill off processes - if you set up chrome to not remember your login details when starting a new session, this would be sufficient (settings > content settings > manage exceptions > add pattern: google.com > dropdown: clear on exit)






                  share|improve this answer


























                    1












                    1








                    1







                    use an external password program that can be set up with requiring a passcode generated by an app on your smartphone, or that can send a text with a one time password to access their database. My personal preference is LastPass.



                    pkill can be used to kill off processes - if you set up chrome to not remember your login details when starting a new session, this would be sufficient (settings > content settings > manage exceptions > add pattern: google.com > dropdown: clear on exit)






                    share|improve this answer













                    use an external password program that can be set up with requiring a passcode generated by an app on your smartphone, or that can send a text with a one time password to access their database. My personal preference is LastPass.



                    pkill can be used to kill off processes - if you set up chrome to not remember your login details when starting a new session, this would be sufficient (settings > content settings > manage exceptions > add pattern: google.com > dropdown: clear on exit)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Sep 24 '13 at 14:21









                    SeanCSeanC

                    3,35421426




                    3,35421426























                        1














                        Just posting this because I couldn't find the answer...
                        The trick is all about https://mail.google.com/mail/?logout&hl=en which logs you out.



                        For Conf room machines that may be left logged in and are set to always be running.



                        Create a bash file called LogOutOfChome.sh in ~/ with contents:



                        #!/bin/bash
                        PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

                        pkill -a -i "Google Chrome"
                        sleep 3
                        Open -a "/Applications/Google Chrome.app" --args 'https://mail.google.com/mail/?logout&hl=en'
                        sleep 15
                        pkill -a -i "Google Chrome"


                        This kills all open instances of Chrome, waits 3 seconds, opens the Gmail logout URL, waits 15 seconds, then kills all instances of Chrome again.



                        From the terminal:
                        chmod +x LogOutOfChrome.sh,
                        which will make it executable.



                        Test it (note, this will close all your Chrome windows and log you out…..)
                        ./LogOutOfChrome.sh



                        Use crontab to schedule it.
                        crontab -l (this is a lower case L)
                        to list if you have anything else scheduled.

                        Edit your crontab with VI.
                        crontab -e

                        Type i (lower case I) to insert

                        Copy/Paste:



                        *   1   *   *   *   ~/LogOutOfChrome.sh


                        Hit Esc, enter :wqEnter
                        to Write and Quit. 
                        This will run the script at (minute, hour, day month, day of week) at hour 1
                        (i.e., 1 AM) of each day.



                        To test this, if it was currently 2:15pm set it to:



                        17  14  *   *   *   ~LogOutOfChrome.sh


                        which is 17 minutes past 14:00 hours (i.e., 2:17 PM).






                        share|improve this answer






























                          1














                          Just posting this because I couldn't find the answer...
                          The trick is all about https://mail.google.com/mail/?logout&hl=en which logs you out.



                          For Conf room machines that may be left logged in and are set to always be running.



                          Create a bash file called LogOutOfChome.sh in ~/ with contents:



                          #!/bin/bash
                          PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

                          pkill -a -i "Google Chrome"
                          sleep 3
                          Open -a "/Applications/Google Chrome.app" --args 'https://mail.google.com/mail/?logout&hl=en'
                          sleep 15
                          pkill -a -i "Google Chrome"


                          This kills all open instances of Chrome, waits 3 seconds, opens the Gmail logout URL, waits 15 seconds, then kills all instances of Chrome again.



                          From the terminal:
                          chmod +x LogOutOfChrome.sh,
                          which will make it executable.



                          Test it (note, this will close all your Chrome windows and log you out…..)
                          ./LogOutOfChrome.sh



                          Use crontab to schedule it.
                          crontab -l (this is a lower case L)
                          to list if you have anything else scheduled.

                          Edit your crontab with VI.
                          crontab -e

                          Type i (lower case I) to insert

                          Copy/Paste:



                          *   1   *   *   *   ~/LogOutOfChrome.sh


                          Hit Esc, enter :wqEnter
                          to Write and Quit. 
                          This will run the script at (minute, hour, day month, day of week) at hour 1
                          (i.e., 1 AM) of each day.



                          To test this, if it was currently 2:15pm set it to:



                          17  14  *   *   *   ~LogOutOfChrome.sh


                          which is 17 minutes past 14:00 hours (i.e., 2:17 PM).






                          share|improve this answer




























                            1












                            1








                            1







                            Just posting this because I couldn't find the answer...
                            The trick is all about https://mail.google.com/mail/?logout&hl=en which logs you out.



                            For Conf room machines that may be left logged in and are set to always be running.



                            Create a bash file called LogOutOfChome.sh in ~/ with contents:



                            #!/bin/bash
                            PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

                            pkill -a -i "Google Chrome"
                            sleep 3
                            Open -a "/Applications/Google Chrome.app" --args 'https://mail.google.com/mail/?logout&hl=en'
                            sleep 15
                            pkill -a -i "Google Chrome"


                            This kills all open instances of Chrome, waits 3 seconds, opens the Gmail logout URL, waits 15 seconds, then kills all instances of Chrome again.



                            From the terminal:
                            chmod +x LogOutOfChrome.sh,
                            which will make it executable.



                            Test it (note, this will close all your Chrome windows and log you out…..)
                            ./LogOutOfChrome.sh



                            Use crontab to schedule it.
                            crontab -l (this is a lower case L)
                            to list if you have anything else scheduled.

                            Edit your crontab with VI.
                            crontab -e

                            Type i (lower case I) to insert

                            Copy/Paste:



                            *   1   *   *   *   ~/LogOutOfChrome.sh


                            Hit Esc, enter :wqEnter
                            to Write and Quit. 
                            This will run the script at (minute, hour, day month, day of week) at hour 1
                            (i.e., 1 AM) of each day.



                            To test this, if it was currently 2:15pm set it to:



                            17  14  *   *   *   ~LogOutOfChrome.sh


                            which is 17 minutes past 14:00 hours (i.e., 2:17 PM).






                            share|improve this answer















                            Just posting this because I couldn't find the answer...
                            The trick is all about https://mail.google.com/mail/?logout&hl=en which logs you out.



                            For Conf room machines that may be left logged in and are set to always be running.



                            Create a bash file called LogOutOfChome.sh in ~/ with contents:



                            #!/bin/bash
                            PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

                            pkill -a -i "Google Chrome"
                            sleep 3
                            Open -a "/Applications/Google Chrome.app" --args 'https://mail.google.com/mail/?logout&hl=en'
                            sleep 15
                            pkill -a -i "Google Chrome"


                            This kills all open instances of Chrome, waits 3 seconds, opens the Gmail logout URL, waits 15 seconds, then kills all instances of Chrome again.



                            From the terminal:
                            chmod +x LogOutOfChrome.sh,
                            which will make it executable.



                            Test it (note, this will close all your Chrome windows and log you out…..)
                            ./LogOutOfChrome.sh



                            Use crontab to schedule it.
                            crontab -l (this is a lower case L)
                            to list if you have anything else scheduled.

                            Edit your crontab with VI.
                            crontab -e

                            Type i (lower case I) to insert

                            Copy/Paste:



                            *   1   *   *   *   ~/LogOutOfChrome.sh


                            Hit Esc, enter :wqEnter
                            to Write and Quit. 
                            This will run the script at (minute, hour, day month, day of week) at hour 1
                            (i.e., 1 AM) of each day.



                            To test this, if it was currently 2:15pm set it to:



                            17  14  *   *   *   ~LogOutOfChrome.sh


                            which is 17 minutes past 14:00 hours (i.e., 2:17 PM).







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Feb 8 at 22:52









                            Scott

                            16.3k113990




                            16.3k113990










                            answered Feb 8 at 22:07









                            NickCNickC

                            111




                            111






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Super User!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f649370%2fis-it-possible-to-log-out-of-chrome-using-the-command-line%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Plaza Victoria

                                Puebla de Zaragoza

                                Musa