Debootrap: Non-interactive shell expand PATH variable





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







1















I installed debian using debootstrap (debootstrap --arch=amd64 stretch /target http://httpredir.debian.org/debian). When I check my PATH variable i get:



ssh git@srv 'echo $PATH'
/usr/bin:/bin


How can I expand it and include e.g. /usr/local/bin?



/etc/passwd:



git:x:108:112:git version control,,,:/home/git:/bin/sh


I already tried the following approaches, but without success because these files are only read for interactive shells. Thanks for advices.



echo 'export PATH="/usr/a1:$PATH"' >> /etc/profile

echo 'PATH="/usr/a2:$PATH"' >> /etc/environment

echo 'export PATH="/usr/a3:$PATH"' >> /home/git/.profile
chown git:git /home/git/.profile

echo 'export PATH="/usr/a4:$PATH"' >> /home/git/.bashrc
chown git:git /home/git/.bashrc

echo 'PATH="/usr/a5:$PATH"' >> /home/git/.ssh/rc
chown git:git /home/git/.ssh/rc

echo 'export PATH="/usr/a6:$PATH"' >> /home/git/.ssh/environment
chown git:git /home/git/.ssh/environment









share|improve this question




















  • 1





    I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

    – Kamil Maciorowski
    Jan 31 at 7:11


















1















I installed debian using debootstrap (debootstrap --arch=amd64 stretch /target http://httpredir.debian.org/debian). When I check my PATH variable i get:



ssh git@srv 'echo $PATH'
/usr/bin:/bin


How can I expand it and include e.g. /usr/local/bin?



/etc/passwd:



git:x:108:112:git version control,,,:/home/git:/bin/sh


I already tried the following approaches, but without success because these files are only read for interactive shells. Thanks for advices.



echo 'export PATH="/usr/a1:$PATH"' >> /etc/profile

echo 'PATH="/usr/a2:$PATH"' >> /etc/environment

echo 'export PATH="/usr/a3:$PATH"' >> /home/git/.profile
chown git:git /home/git/.profile

echo 'export PATH="/usr/a4:$PATH"' >> /home/git/.bashrc
chown git:git /home/git/.bashrc

echo 'PATH="/usr/a5:$PATH"' >> /home/git/.ssh/rc
chown git:git /home/git/.ssh/rc

echo 'export PATH="/usr/a6:$PATH"' >> /home/git/.ssh/environment
chown git:git /home/git/.ssh/environment









share|improve this question




















  • 1





    I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

    – Kamil Maciorowski
    Jan 31 at 7:11














1












1








1








I installed debian using debootstrap (debootstrap --arch=amd64 stretch /target http://httpredir.debian.org/debian). When I check my PATH variable i get:



ssh git@srv 'echo $PATH'
/usr/bin:/bin


How can I expand it and include e.g. /usr/local/bin?



/etc/passwd:



git:x:108:112:git version control,,,:/home/git:/bin/sh


I already tried the following approaches, but without success because these files are only read for interactive shells. Thanks for advices.



echo 'export PATH="/usr/a1:$PATH"' >> /etc/profile

echo 'PATH="/usr/a2:$PATH"' >> /etc/environment

echo 'export PATH="/usr/a3:$PATH"' >> /home/git/.profile
chown git:git /home/git/.profile

echo 'export PATH="/usr/a4:$PATH"' >> /home/git/.bashrc
chown git:git /home/git/.bashrc

echo 'PATH="/usr/a5:$PATH"' >> /home/git/.ssh/rc
chown git:git /home/git/.ssh/rc

echo 'export PATH="/usr/a6:$PATH"' >> /home/git/.ssh/environment
chown git:git /home/git/.ssh/environment









share|improve this question
















I installed debian using debootstrap (debootstrap --arch=amd64 stretch /target http://httpredir.debian.org/debian). When I check my PATH variable i get:



ssh git@srv 'echo $PATH'
/usr/bin:/bin


How can I expand it and include e.g. /usr/local/bin?



/etc/passwd:



git:x:108:112:git version control,,,:/home/git:/bin/sh


I already tried the following approaches, but without success because these files are only read for interactive shells. Thanks for advices.



echo 'export PATH="/usr/a1:$PATH"' >> /etc/profile

echo 'PATH="/usr/a2:$PATH"' >> /etc/environment

echo 'export PATH="/usr/a3:$PATH"' >> /home/git/.profile
chown git:git /home/git/.profile

echo 'export PATH="/usr/a4:$PATH"' >> /home/git/.bashrc
chown git:git /home/git/.bashrc

echo 'PATH="/usr/a5:$PATH"' >> /home/git/.ssh/rc
chown git:git /home/git/.ssh/rc

echo 'export PATH="/usr/a6:$PATH"' >> /home/git/.ssh/environment
chown git:git /home/git/.ssh/environment






debian path debootstrap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 31 at 22:32







Pete

















asked Jan 30 at 20:04









PetePete

62




62








  • 1





    I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

    – Kamil Maciorowski
    Jan 31 at 7:11














  • 1





    I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

    – Kamil Maciorowski
    Jan 31 at 7:11








1




1





I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

– Kamil Maciorowski
Jan 31 at 7:11





I already tried different approaches -- This vague statement is not helpful. Please edit the question and tell us what you tried exactly.

– Kamil Maciorowski
Jan 31 at 7:11










2 Answers
2






active

oldest

votes


















0














SSH commands like this are not affected by login or interactive environment variables.



This question is similar to the one asked here:
https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command



Try like this:



echo "export PATH=$PATH:/usr/local/bin" >> ~/.ssh/environment






share|improve this answer


























  • Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

    – Pete
    Jan 31 at 18:05











  • That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

    – HackSlash
    Jan 31 at 18:13











  • I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

    – Pete
    Jan 31 at 19:51











  • Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

    – HackSlash
    Jan 31 at 20:39



















0














You can execute commands in a login shell on the remote host, which will process your shell config files (e.g. ~/.profile, etc):



ssh user@host 'exec $SHELL -l -c "echo $PATH; commmand; another-command"'


Depending on what you are trying to do, might need to tell ssh to create a pseudo-tty:



ssh user@host -t 'exec $SHELL -l -c "command-that-needs-tty"'





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%2f1400236%2fdebootrap-non-interactive-shell-expand-path-variable%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    SSH commands like this are not affected by login or interactive environment variables.



    This question is similar to the one asked here:
    https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command



    Try like this:



    echo "export PATH=$PATH:/usr/local/bin" >> ~/.ssh/environment






    share|improve this answer


























    • Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

      – Pete
      Jan 31 at 18:05











    • That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

      – HackSlash
      Jan 31 at 18:13











    • I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

      – Pete
      Jan 31 at 19:51











    • Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

      – HackSlash
      Jan 31 at 20:39
















    0














    SSH commands like this are not affected by login or interactive environment variables.



    This question is similar to the one asked here:
    https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command



    Try like this:



    echo "export PATH=$PATH:/usr/local/bin" >> ~/.ssh/environment






    share|improve this answer


























    • Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

      – Pete
      Jan 31 at 18:05











    • That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

      – HackSlash
      Jan 31 at 18:13











    • I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

      – Pete
      Jan 31 at 19:51











    • Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

      – HackSlash
      Jan 31 at 20:39














    0












    0








    0







    SSH commands like this are not affected by login or interactive environment variables.



    This question is similar to the one asked here:
    https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command



    Try like this:



    echo "export PATH=$PATH:/usr/local/bin" >> ~/.ssh/environment






    share|improve this answer















    SSH commands like this are not affected by login or interactive environment variables.



    This question is similar to the one asked here:
    https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command



    Try like this:



    echo "export PATH=$PATH:/usr/local/bin" >> ~/.ssh/environment







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 31 at 20:38

























    answered Jan 30 at 20:28









    HackSlashHackSlash

    2,3722723




    2,3722723













    • Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

      – Pete
      Jan 31 at 18:05











    • That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

      – HackSlash
      Jan 31 at 18:13











    • I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

      – Pete
      Jan 31 at 19:51











    • Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

      – HackSlash
      Jan 31 at 20:39



















    • Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

      – Pete
      Jan 31 at 18:05











    • That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

      – HackSlash
      Jan 31 at 18:13











    • I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

      – Pete
      Jan 31 at 19:51











    • Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

      – HackSlash
      Jan 31 at 20:39

















    Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

    – Pete
    Jan 31 at 18:05





    Unfortunately I did not yet find the location where I have to place this export statement. Can you give me further advise?

    – Pete
    Jan 31 at 18:05













    That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

    – HackSlash
    Jan 31 at 18:13





    That's a command that you run on any shell. You need to add it to your ~/.profile or ~/.bashrc file if you want it to load automatically.

    – HackSlash
    Jan 31 at 18:13













    I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

    – Pete
    Jan 31 at 19:51





    I have it already in /etc/profile, /etc/environment, ~/.profile, ~/.bashrc without success. "ssh git@srv 'echo $PATH'" still returns "/usr/bin:/bin"

    – Pete
    Jan 31 at 19:51













    Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

    – HackSlash
    Jan 31 at 20:39





    Sorry, I didn't realize the problem was that you are pushing commands via SSH. See my updated answer.

    – HackSlash
    Jan 31 at 20:39













    0














    You can execute commands in a login shell on the remote host, which will process your shell config files (e.g. ~/.profile, etc):



    ssh user@host 'exec $SHELL -l -c "echo $PATH; commmand; another-command"'


    Depending on what you are trying to do, might need to tell ssh to create a pseudo-tty:



    ssh user@host -t 'exec $SHELL -l -c "command-that-needs-tty"'





    share|improve this answer




























      0














      You can execute commands in a login shell on the remote host, which will process your shell config files (e.g. ~/.profile, etc):



      ssh user@host 'exec $SHELL -l -c "echo $PATH; commmand; another-command"'


      Depending on what you are trying to do, might need to tell ssh to create a pseudo-tty:



      ssh user@host -t 'exec $SHELL -l -c "command-that-needs-tty"'





      share|improve this answer


























        0












        0








        0







        You can execute commands in a login shell on the remote host, which will process your shell config files (e.g. ~/.profile, etc):



        ssh user@host 'exec $SHELL -l -c "echo $PATH; commmand; another-command"'


        Depending on what you are trying to do, might need to tell ssh to create a pseudo-tty:



        ssh user@host -t 'exec $SHELL -l -c "command-that-needs-tty"'





        share|improve this answer













        You can execute commands in a login shell on the remote host, which will process your shell config files (e.g. ~/.profile, etc):



        ssh user@host 'exec $SHELL -l -c "echo $PATH; commmand; another-command"'


        Depending on what you are trying to do, might need to tell ssh to create a pseudo-tty:



        ssh user@host -t 'exec $SHELL -l -c "command-that-needs-tty"'






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 1 at 2:28









        crimson-egretcrimson-egret

        1,370613




        1,370613






























            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%2f1400236%2fdebootrap-non-interactive-shell-expand-path-variable%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

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]