linux 用户管理
Step 1 — Creating a User for Kafka
Since Kafka can handle requests over a network, you should create a dedicated user for it. This minimizes damage to your Ubuntu machine should the Kafka server be compromised. We will create a dedicated kafka user in this step, but you should create a different non-root user to perform other tasks on this server once you have finished setting up Kafka.
Logged in as your non-root sudo user, create a user called kafka with the useradd command:
- sudo useradd kafka -m
The -m flag ensures that a home directory will be created for the user. This home directory, /home/kafka, will act as our workspace directory for executing commands in the sections below.
Set the password using passwd:
- sudo passwd kafka
Add the kafka user to the sudo group with the adduser command, so that it has the privileges required to install Kafka’s dependencies:
- sudo adduser kafka sudo
Your kafka user is now ready. Log into this account using su:
- su -l kafka
Now that we’ve created the Kafka-specific user, we can move on to downloading and extracting the Kafka binaries.

浙公网安备 33010602011771号