ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Keep my ssh config file synchronized between two systems

    IT Discussion
    ssh ssh client config synchronization sync
    3
    9
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JaredBusch
      last edited by JaredBusch

      Since I move back and forth constantly from my desktop to laptop, I want to keep the ~/.ssh/config file synchronized between the two systems.

      I access too many different systems to want to memorize them all. I personally find that using this file to make friendly names based on client and purpose makes it easy. Also tab completion 😛

      I only have system info in here, nothing else.

      6b56541a-f6dc-4fcf-a5e4-2b3503d4cdfc-image.png

      Drop it in my personal folder on Nextcloud and link it? Something else?

      Any recommendations?

      Edit: I never tried that above Nextcloud and link suggestion because of expected permission issues.
      ce0d8407-f463-4087-9b35-336061739cf1-image.png

      1 Reply Last reply Reply Quote 0
      • B
        black3dynamite
        last edited by black3dynamite

        Using Nextcloud to sync your config

        # Store your config in your Nextcloud directory
        # --preserve=context should copy over the selinux permissions with file to your Nextcloud folder.
        cp --preserve=context /home/<user>/.ssh/config /home/<user>/Nextcloud/
        ln -s /home/<user>/Nextcloud/config /home/<user>/.ssh/config
        
        J 1 Reply Last reply Reply Quote 1
        • B
          black3dynamite
          last edited by

          This might be overkill for one file but you setup syncthing too.
          https://syncthing.net/

          J 1 Reply Last reply Reply Quote 0
          • J
            JaredBusch @black3dynamite
            last edited by

            @black3dynamite said in Keep my ssh config file synchronized between two systems:

            This might be overkill for one file but you setup syncthing too.
            https://syncthing.net/

            I keep forgetting about this solution. It is not something I personally have a need for, but I know people that could use it.

            1 Reply Last reply Reply Quote 0
            • J
              JaredBusch @black3dynamite
              last edited by

              @black3dynamite said in Keep my ssh config file synchronized between two systems:

              Using Nextcloud to sync your config

              # Store your config in your Nextcloud directory
              # --preserve=context should copy over the selinux permissions with file to your Nextcloud folder.
              cp --preserve=context /home/<user>/.ssh/config /home/<user>/Nextcloud/
              ln -s /home/<user>/Nextcloud/config /home/<user>/.ssh/config
              

              Yeah, I was about to try this. MOstly posted to see about other options in case it has issues.

              1 Reply Last reply Reply Quote 0
              • B
                black3dynamite
                last edited by black3dynamite

                # Use -F option to specify a different config int the default location or other locations.
                ssh -F /home/<user>/Nextcloud/config <user>@host1
                

                Create an alias in your .bashrc file and the following to avoid typing all that.

                alias sshf="ssh -F /home/<user>/Nextcloud/config"
                alias scpf="scp -F /home/<user>/Nextcloud/config"
                # ssh command
                sshf <user>@host1
                # scp command
                scpf <filename> <user>@host1:/tmp/
                

                And for any reasons you want to ignore the config file you use /dev/null

                ssh -F /dev/null <user>@host1
                
                1 Reply Last reply Reply Quote 0
                • S
                  stacksofplates
                  last edited by

                  I use git for this type of stuff. I have all of my dotfiles stored in a git repo and synced between systems.

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    JaredBusch @stacksofplates
                    last edited by

                    @stacksofplates said in Keep my ssh config file synchronized between two systems:

                    I use git for this type of stuff. I have all of my dotfiles stored in a git repo and synced between systems.

                    I thought about that, but then it gets into git triggers and scheduled jobs.

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      stacksofplates @JaredBusch
                      last edited by stacksofplates

                      @JaredBusch said in Keep my ssh config file synchronized between two systems:

                      @stacksofplates said in Keep my ssh config file synchronized between two systems:

                      I use git for this type of stuff. I have all of my dotfiles stored in a git repo and synced between systems.

                      I thought about that, but then it gets into git triggers and scheduled jobs.

                      I just do it when I open my terminal. It auto downloads when a new window is opened.

                      uptodate.png

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post