Friday, December 21, 2018
Thursday, December 20, 2018
Set up an SSH server with the key! freeBSD
For basic mechanism, you may consider the public key as the lock and the private key as its key.
"A word of caution – the root account should NEVER have SSH access. If somehow someone breaks into the SSH server they would have administrative access. Administrative access can always be obtained by using su and entering the root password – which should be different from the user’s password!"
FreeBSD has an SSH server and client out of the box, it just needs to be enabled.
You need ssh public/private key first, so let's make it.
Initial login with no key pair (default):
# ssh junayed@192.168.10.114 (my ssh server LAN IP)
links: https://man.openbsd.org/ssh-keygen.1,
Generating a new SSH key and adding it to the ssh-agent
Securing your SSH Server
Lastly:
If you don’t plan to use SFTP/SCP to transfer files you should disable it. Do this by commenting out the line that starts with # Subsystem sftp.
Don't forgot: Setting up your router port forwarding to :22
Funny mistake: You need to login from outside network to login with the public IP!
"A word of caution – the root account should NEVER have SSH access. If somehow someone breaks into the SSH server they would have administrative access. Administrative access can always be obtained by using su and entering the root password – which should be different from the user’s password!"
FreeBSD has an SSH server and client out of the box, it just needs to be enabled.
You need ssh public/private key first, so let's make it.
Initial login with no key pair (default):
# ssh junayed@192.168.10.114 (my ssh server LAN IP)
links: https://man.openbsd.org/ssh-keygen.1,
Generating a new SSH key and adding it to the ssh-agent
Configuring sshd
# ssh-keygen -t rsa -b 4096 -C "y@ex.com"
# ssh-keygen -t ecdsa -b 4096 -C "y@ex.com" -f ~/.ssh/freeBSD -N abc123
here,
[
[
[
[
[
AUTHORIZED KEY:
Create a key pair from your desktop bash /OR inside in server directly(not from the root account):
here,
[
-C comment][
-t dsa | ecdsa | ed25519 | rsa][
-b bits] 4096[
-f output_keyfile][
-N new_passphrase]
Sample Server credentials details,
port: 22
Server name: mg1149
-f freeBSD -N xyz987
AUTHORIZED KEY:
An authorized key in SSH is a public key used for granting login access to users. The authentication mechanism is called public key authentication.
Authorized keys are configured separately for each user - usually in the .ssh/authorized_keys file in the user's home directory. However, the location of the keys can be configured in SSH server configuration files and is often changed to a root-owned location in more secure environments.
Typically provisioning an authorized key involves generating a key pair, installing the public key as an authorized key, and using the private key as an identity key.
The first command will add your desktop’s public key to the server’s list of allowed desktop computers to connect (authorized keys)
The first command will add your desktop’s public key to the server’s list of allowed desktop computers to connect (authorized keys)
Option 1: Operation inside the server;
# cat id_rsa.pub >> ~/.ssh/authorized_keys
# rm id_rsa.pub
# cat ~/.ssh/id_rsa
Copy the content and paste it into a blank file, name it id_rsa.
From your desktop, make login with this private keys.
$ ssh -i ~/.ssh/freeBSD2 junayed@192.168.10.114 -p 22
Option 2: Operation from the desktop;
You need to use the SSH-COPY-ID
Create lock/key from your desktop, then copy the Lock/Public-key to the server using
# ssh-copy-id -i ~/.ssh/mykey user@host
# ssh-copy-id -i ~/.ssh/freeBSD.pub junayed@192.168.10.114 /103.10....
(Login to the machine)
(Authorize and delete public key)
# cat id_rsa.pub >> ~/.ssh/authorized_keys
# rm id_rsa.pub
# ssh-copy-id -i ~/.ssh/mykey user@host
# ssh-copy-id -i ~/.ssh/freeBSD.pub junayed@192.168.10.114 /103.10....
(Login to the machine)
Adding your SSH key to the ssh-agent:
# eval $(ssh-agent -s)
# ssh-add ~/.ssh/freeBSD
Log in to the server with the private key:
# ssh -i ~/.ssh/freeBSD junayed@192.168.10.114 -p 22
Lastly:
Don't forgot: Setting up your router port forwarding to :22
Funny mistake: You need to login from outside network to login with the public IP!
SFTP freeBSD
SFTP port is open by default by AWS. So just log in, and ftp.
# sftp -i "aws-domo.pem" ubuntu@ec2-13-55-197-77.ap-southeast-2.compute.amazonaws.com
Check Present Working Directory from a remote server.
sftp> lpwd
Remote working directory: /tecmint/
Local working directory:
sftp> pwd
Upload a File
sftp> put local.profile
However, if you don’t plan to use SFTP/SCP to transfer files you should disable it. Do this by commenting out the line that starts with # Subsystem sftp at the bottom of the file.
# ee /etc/ssh/sshd_config
Don't forget: Setting up your router port forwarding to 22
Funny mistake: You need to log in from the outside network to log in with the public IP!
Wednesday, December 19, 2018
FreeBSD 10.x download and Installation
Installation Settings:
Hostname: mg1149
HDD capacity: 224GB
File system and partitioning:
/ = 221GB = freebsd-ufs
/home = 1024MB = freebsd-ufs
[empty] = 2048MB = freebsd-swap [half of size of your RAM for the swap]
user root / pass abc123
user junayed / pass abc123
Link: FreeBSD Unix: Downloading and Installing 10.x
Go from install disk to Firefox in FreeBSD!: Install FreeBSD (with GUI!)
Hostname: mg1149
HDD capacity: 224GB
File system and partitioning:
/ = 221GB = freebsd-ufs
/home = 1024MB = freebsd-ufs
[empty] = 2048MB = freebsd-swap [half of size of your RAM for the swap]
user root / pass abc123
user junayed / pass abc123
Link: FreeBSD Unix: Downloading and Installing 10.x
Friday, December 14, 2018
Login in EC2 with root user - freeBSD
1: Use the SSH to connect to the EC2 FreeBSD instance with the username "ec2-user".
# ssh -i "aws-domo.pem" ec2-user@x.amazonaws.com
It will not require any pass from you.
2: run the command "su" to gain superuser privilege, it will make you the "root" user.
Enjoy!
2: run the command "su" to gain superuser privilege, it will make you the "root" user.
Enjoy!
Thursday, June 28, 2018
Create a Facebook cover photo Tips
You can follow this nice tutorial to make a cover photo for yours.
Open Photoshop. Select File > New. Name the file “cover-photo.” Set the width to 815 pixels, the height to 351 pixels, and resolution to 72 pixels/inch.Tuesday, September 5, 2017
Installing Node.js on Shared hosting (Godaddy / Hostgator)
I will show you how to install Node.js on shared hosting. Please like and subscribe.
Finding the installed location of NODE.js:
Varify installation of NVM:
Update Node over existing installation:
Check NPM Globals:
which node which npm which nvm
NVM website: https://github.com/nvm-sh/nvm
You may run this code for download.Check your bashrc recent modification for the changes.
You may run this code for download.
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bashVarify installation of NVM:
nvm -vThe fact is, on 2020 I have realized that my Godaddy hosting provides python 2.6 which is not compatible with the node v13, thus you need to install node v10 Lts for now. It worth mention that you can have multiple version installed with the NVM but only one could be active. Update Node over existing installation:
nvm ls-remote --lts=Erbium
nvm install --lts=Erbium
nvm use node
nvm -v nvm cache clear
Install Node.js:
nvm_get_os
nvm_get_arch
nvm uninstall v13.6.0
nvm install v10.18
nvm install v11 (Now v11 is supporting on Goddady/Hostgator 2020) nvm install --lts=Erbium (v12 lts on Crazydomain on 2020)
npm -v
nvm run node --version
nvm run node v11.15.0
nvm use node
nvm use node v11.15.0nvm use v10.18.0npm -v
To check the currently active version:
node -v
npm -v # Display currently activated version of Node nvm current nvm version nvm which current
npm list -g
NPM Node module Full reset of a Laravel project:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
List remotely installed versions:
nvm ls
nvm ls-remote v10
nvm ls-remote --lts
nvm ls-remote --lts=Erbium
Subscribe to:
Posts (Atom)