Skip to main content

Posts

Showing posts from December, 2023

How to enable and configure root user’s SSH login on Azure Ubuntu

If you are using Microsoft’s Azure Ubuntu, you may find that the default normal user azureuser has some limitations, such as not being able to use ports below 1024 when setting up SSH Server2Client (S2C) port mapping. At this time, you may want to use the root user to gain higher privileges and flexibility. However, Azure Ubuntu does not directly support root user login, you need to do some configuration to achieve it. This article will introduce how to enable and configure root user’s SSH login on Azure Ubuntu, and how to use root user’s SSH public key login method. Enable root user’s password login First, we need to set a password for the root user, and then modify some configuration files to allow root user’s password login. The specific steps are as follows: Log in to the system as a normal user azureuser, open the terminal, and enter the following command to set a password for the root user: sudo passwd root Enter your azureuser password, then enter the root password you want to s...

设置azure ubuntu root用户公钥登录方法

如果你使用的是微软的Azure Ubuntu,你可能会发现默认的普通用户azureuser有一些限制,比如在SSH设置Server2Client(S2C)端口映射时,无法使用1024以下的端口号。这时,你可能想要使用root用户来获得更高的权限和灵活性。但是,Azure Ubuntu并不直接支持root用户的登录,你需要进行一些配置才能实现。本文将介绍如何在Azure Ubuntu上启用并配置root用户的SSH登录,以及如何使用root用户的SSH公钥登录方式。 启用root用户的密码登录 首先,我们需要为root用户设置一个密码,然后修改一些配置文件,以允许root用户的密码登录。具体的步骤如下: 以普通用户azureuser登录系统,打开终端,输入以下命令,为root用户设置一个密码: sudo passwd root 输入你的azureuser的密码,然后输入你想要设置的root密码,再次确认。 输入以下命令,编辑SSH的配置文件: sudo nano /etc/ssh/sshd_config 找到以下参数,将其改为yes: PermitRootLogin yes 保存并退出SSH的配置文件,重启SSH服务: sudo service sshd restart 现在,原则上就可以使用root密码来登录root用户了。你可以使用以下命令: ssh root@your_server_ip 配置root用户的SSH公钥登录 然而,出于安全考虑,Azure Ubuntu禁止密码登录,只能采用public key登录。这意味着你需要生成一对SSH的密钥,然后将公钥上传到服务器,才能使用私钥来登录。这样做的好处是,你不需要记住或输入密码,也不需要担心密码被破解或泄露。方法如下: SSH客户端中产生一个新的密码对key pair,例如 Bitvise SSH Client -->Client Key Manager–>Generate New。 新产生的密码对 key pair导出其Public Key文件,选择OpenSSH Format,例如为a.pub 把这个文件上传到ubuntu中,例如 /home/azueruser/a.pub 以普通用户azureuser登录系统,打开终端,输入以下命令,提权到root: sudo -i 将公钥文件a.pub复制...

About TCP Analysis & How to Use Wireshark

TCP (Transmission Control Protocol) is one of the most important protocols in the Internet, as it provides reliable, ordered, and error-checked delivery of data between applications. TCP analysis is the process of examining TCP packets to detect and troubleshoot various network issues, such as packet loss, retransmission, latency, window size, connection state, etc. TCP analysis can help us improve network performance, security, and efficiency. Wireshark is a powerful and popular open-source network analysis tool that can capture and display packets of various protocols, and provide rich filtering and statistical features. Wireshark can help us quickly locate and solve network communication problems, and understand the TCP protocol better. In this blog, I will share some tips and tricks on how to use Wireshark for TCP analysis, based on some common scenarios and tasks. Tip 1: How to capture TCP packets The first step of TCP analysis is to capture the TCP packets that we are interested ...

About TCP SYN packets & How to Protect Your Server from SYN Flood Attacks

SYN flood attacks are a type of denial-of-service (DoS) attack that aim to exhaust the resources of a server by sending a large number of TCP SYN packets with fake or spoofed source IP addresses or ports. The server responds to each SYN packet with a SYN-ACK packet, but never receives the final ACK packet from the client, leaving many half-open connections that consume memory and CPU. As a result, the server becomes unable to accept new legitimate connections and provide normal services. In this blog post, we will explain how SYN-ACK packets work, how they are used in SYN flood attacks, and how you can defend your server from such attacks. What are SYN-ACK packets? SYN-ACK packets are part of the TCP three-way handshake process, which is used to establish a reliable connection between a client and a server. The TCP three-way handshake consists of the following steps: The client sends a SYN packet to the server, indicating its intention to start a communication and providing its initial...

How to Set Buffer Size for TCP Socket Programming in C++

TCP socket programming is a common way to communicate between different processes or machines over the network. However, one of the challenges of TCP socket programming is how to set the buffer size for sending and receiving data. The buffer size determines how much data can be stored in memory before it is transmitted or processed. If the buffer size is too small, the data may be fragmented or lost, resulting in poor performance or errors. If the buffer size is too large, the memory may be wasted or the data may be delayed, affecting the responsiveness or timeliness of the communication. In this blog post, I will explain how to set the buffer size for TCP socket programming in C++, and provide some examples of how to use the relevant functions and parameters. The buffer size for TCP socket programming in C++ can be set by using the setsockopt function, which allows the programmer to change the options for a socket. The setsockopt function has the following prototype: int setsockopt...

Fix the NS Records of Your AWS Registered Domains and Hosted Zones

If you are using AWS Route 53 to manage your domains and DNS records, you may encounter a situation where the NS records of your registered domains and hosted zones are not consistent. This can cause problems with your domain’s DNS resolution and affect your website’s availability and performance. In this blog post, I will explain what are the NS records of registered domains and hosted zones, how they differ, and how to fix them if they are not aligned. contact email:  tcpfast@gmail.com  What are the NS records of registered domains and hosted zones? NS stands for name server, which is a server that translates domain names into IP addresses. NS records are DNS records that specify which name servers are responsible for resolving a domain name. There are two types of NS records that you need to be aware of when using Route 53: the NS records of registered domains and the NS records of hosted zones. The NS records of registered domains are the ones that determine which DNS serv...

一文看懂,AWS Registered domains 的 NS 字段 与 Hosted zone 的 NS 字段

Registered domains 的 NS 字段 与 Hosted zone 的 NS 字段 的 区别是: - Registered domains 的 NS 字段 是指定您的域名应该由哪些 DNS 服务器来解析的。它决定了您的域名的 DNS 请求被发送到哪个 DNS 服务商,例如 Route 53。 - Hosted zone 的 NS 字段 是由 Route 53 自动生成的,反映了 Route 53 为您的托管区域分配的名称服务器的地址。它决定了您的域名的 DNS 解析结果是由哪些 DNS 服务器提供的。 简单来说,Registered domains 的 NS 字段 是您的域名的 DNS 解析的入口,而 Hosted zone 的 NS 字段 是您的域名的 DNS 解析的出口。 当浏览器请求一个域名,例如 tcpbuilder.com 时,是如何使用 Registered domains 的 NS 字段 与 Hosted zone 的 NS 字段 的,具体过程如下: - 浏览器首先会检查本地缓存或者 hosts 文件,看是否有 abc.com 对应的 IP 地址。如果有,就直接访问该 IP 地址。如果没有,就需要进行 DNS 解析。 - 浏览器会向本地配置的 DNS 服务器(通常是运营商提供的)发送一个查询请求,询问 tcpbuilder.com 的 IP 地址。 - DNS 服务器会根据 tcpbuilder.com 的 TLD(.com)找到对应的根域名服务器,向其发送查询请求。 - 根域名服务器会返回负责 .com 域的顶级域名服务器的地址,DNS 服务器再向其发送查询请求。 - 顶级域名服务器会返回负责 abc.com 域的权威域名服务器的地址,DNS 服务器再向其发送查询请求。 - 权威域名服务器会返回 abc.com 域的 IP 地址,DNS 服务器将其缓存并返回给浏览器。 - 浏览器根据得到的 IP 地址,与 tcpbuilder.com 域的 web 服务器建立 TCP 连接,发起 HTTP 请求。 在这个过程中,Registered domains 的 NS 字段 和 Hosted zone 的 NS 字段 起到了不同的作用: - Registered domains 的 NS 字段 是在顶级域名服务器 中记录的,用于指定 tcpbui...