Developing lambdas - AWS SAM with VSCode and Linux: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 63: Line 63:
[[File:Ssh5.png]]
[[File:Ssh5.png]]
[[File:Ssh6.png]]
[[File:Ssh6.png]]
== Disable SUDO password ==
Add NOPASSWD for sudo group
<syntaxhighlight lang="bash">
sudo visudo
%sudo  ALL=(ALL:ALL) NOPASSWD:ALL
</syntaxhighlight>
== SSH agent for all user sessions ==
There are many tutorials how to make ssh agent working, one of main problems is that they are usually valid only for one bash session. This is not really usable for VS Code because every new terminal start with a new bash session and you do not want to reenter password every time.
Furthermore because you have locally stored SSH key without password to access your linux machine you should also have a real private key on your linux machine to e.g. commit changes to a GIT repository. For this purpose I have a tutorial with background SSH agent service which will run as a daemon and ssh agent will be valid for all user sessions.
=== /etc/rc.local ===
<syntaxhighlight lang="bash">
#!/bin/bash
sudo -umkonicek ssh-agent > /home/mkonicek/.ssh-agent
</syntaxhighlight>
=== /etc/systemd/system/rc-local.service ===
<syntaxhighlight lang="bash">
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
</syntaxhighlight>
=== Enable service ===
<syntaxhighlight lang="bash">
systemctl start rc-local
systemctl enable rc-local
</syntaxhighlight>
=== ~/.bashrc ===
<syntaxhighlight lang="bash">
. ~/.ssh-agent
</syntaxhighlight>

Navigation menu