0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

aws ubuntu コマンドラインとssh 接続

Last updated at Posted at 2024-01-20

aws

ssh -i "key.pem" public_ip

nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 14
node -v
npm -v

postgresql

apt-get install 'postgresql-*'
sudo su
\passwd postgres

ssh-keygen

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
cat /home/ubuntu/.ssh/id_rsa.pub

git clone

sudo mkdir project
sudo chown ubuntu project/
cd project
git clone ssh-link

vim

vim file.type
a
ESC
:wq

postgres データベースのエクスポート data output

pg_dump -h ip -p 5432 -U username db_name > db.sql

sftp アップロード ファイル

sftp -i key.pem ubuntu@ip
put db.sql

postgres データベースへのインポート data input

sudo chown postgres /home/ubuntu/db.sql
su postgres
psql -d db_name -f db.sql

screen 後台でのタスク ランニング

screen -r
screen -s task_name #new task
CTRL a c
npm run prod
CTRL a n #next task
# CTRL a p #preview

password authentication failed for user "postgres"

su postgres
psql
ALTER USER postgres WITH PASSWORD 'password';

image.png

NO supported authentication methods available(server sent: publickey)

Server refused our key

ec2-ppk-pem-conversion と putty-private-key

EC2 Instance Connect

SSH設定
vim /etc/ssh/sshd_config

PubkeyAuthentication yes

因みに、安全のために、PermitRootLogin PasswordAuthentication PermitEmptyPasswordsが禁止。

PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?