🎩
wilmerags 🌱
  • Home
  • Social
  • Cloud
    • Aws
  • Stats
  • Code
    • Scrum
    • Ssh
    • Vim
    • Dvc
    • Postgresql
    • Tmux
    • Terraform
    • Web tools
    • Sql
    • Rest api
    • Mongo
    • Docker
    • Octave
    • Elasticsearch
    • Kubernetes
    • Bash
    • Rabbitmq
    • Databases
      • Mongo
      • Elasticsearch
      • Sql
        • Postgresql
    • Devops
      • Terraform
      • Docker
      • Kubernetes
      • Rabbitmq
    • Python
      • Airflow
      • Keras
      • Spark
      • Azure
      • Matplotlib
      • Jupyter
      • Numpy
      • Databases
      • Sklearn
      • Requests
      • Pandas
      • Elasticsearch
      • Tensorflow
    • Git
      • Gitflow
    • R
      • Lpsolve
  • Indie-hacker
  • Macos
  • Interesting
  • Thoughts
    • Health
    • Work
    • Relationships
    • On the need of expressiveness
    • On organizing knowledge
    • On the importance of questions
  • Linux
    • Vim
    • Tmux
  • Webdev
    • Vue
  • Readings
    • Psychology
    • Habits
    • Projects management
    • Quotes
    • Dopamine detox
  • Ai
    • Ml
      • Xgboost
      • Performance evaluation
      • Community detection
      • Cloud_platforms
        • Ai platform
        • Sagemaker
      • Unsupervised_learning
    • Nlp
    • DS
Powered by GitBook
On this page
  1. Code

Ssh

Frequently used ssh snippets

PreviousScrumNextVim

Was this helpful?

CtrlK
  • How to's
  • Port forwarding
  • .pem managing
  • Add user
  • References

Was this helpful?

How to's

Port forwarding

Say we want to connect to a web server running at example.com:8080 and we have user to connect to the server. We can create a tunel to see the server on our local port 9000 by doing:

ssh -L 9000:localhost:8080 user@example.com

localhost:8080, is to forward connections from your local port 9000 to localhost:8080 on your server. Now we can simply connect to our webserver.

.pem managing

chmod 400 *.pem

Add user

  1. execute

    sudo adduser user
  2. then, edit /etc/ssh/sshd_config and add/edit:

    AllowUsers user
    PasswordAuthentication yes
  3. then, execute

sudo service ssh reload

Add to sudoers

usermod -aG sudo user

Review ssh login attemps

sudo vim /var/log/auth.log

Copy the file "foobar.txt" from the local host to a remote host

  • scp foobar.txt your_username@remotehost.edu:/some/remote/directory

References

  • Port forwarding