ubuntu的各种工具配置

1.nfs:虚拟机桥接模式下,开发板和虚拟机保持在同一网段下,开发板不要直连电脑

挂载命令:mount -v -t nfs 192.168.110.154:/home/lhj /mnt -o nolock

(1) 安装 NFS 服务器

sudo apt update

sudo apt install nfs-kernel-server -y

(2) 创建共享目录并设置权限

sudo mkdir -p /mnt/nfs_share

sudo chown nobody:nogroup /mnt/nfs_ # 修改所有权 注意共享文件夹路径为/mnt/nfs

sudo chmod 777 /mnt/nfs_ # 开放读写权限(测试用,生产环境需限制)

(3) 配置 NFS 共享

sudo vi /etc/exports

添加以下内容(允许所有客户端访问):

/mnt/nfs_*(rw,sync,no-subtree-check,no-root-squash)注意-是下划线!!!!!!

检查是否有语法错误sudo exportfs -rv

(4) 生效配置并启动服务

sudo exportfs -a # 重新加载配置

sudo systemctl restart nfs-kernel-server # 重启服务

sudo systemctl enable nfs-kernel-server # 开机自启

sudo systemctl status nfs-kernel-server

重启:sudo service nfs-kernel-server status

重启:sudo service nfs-kernel-server restart

(5) 检查 NFS 共享是否发布成功

showmount -e localhost

输出应显示:

Export list for localhost:

/mnt/nfs_share *

  1. 在客户端挂载 NFS 共享

(1) 客户端安装 NFS 工具

sudo apt update

sudo apt install nfs-common -y

(2) 创建本地挂载点

sudo mkdir -p /mnt/nfs_client

(3) 手动挂载 NFS 共享

sudo mount -t nfs <虚拟机IP>:/mnt/nfs_share /mnt/nfs_client

/home/lhj 192.168.110.113/24(rw,sync,no_root_squash,no_subtree_check)

  1. 设置开机自动挂载

sudo nano /etc/fstab

<虚拟机IP>:/mnt/nfs_share /mnt/nfs_client nfs defaults 0 0

2.samba

sudo vi /etc/samba/smb.conf

sudo systemctl restart smbd nmbd

sudo systemctl status smbd nmbd

I

3.ssh

sudo vi /etc/ssh/sshd_config

sudo systemctl status ssh

sudo systemctl restart ssh 通过这个命令重启

设置

PasswordAuthentication yes # 如果使用密码登录

PubkeyAuthentication yes # 如果使用密钥登录

4.切换root账号

su -或者 su root

4.1 以 root 用户身份启动一个交互式 shell,并加载 root 用户的环境变量:sudo -i 更推荐

4.2 su:切换到 root 用户(需要输入 root 用户的密码)。

4.3 sudo su:使用当前用户的 sudo 权限来运行 su 命令,从而切换到 root 用户(需要输入当前用户的密码,而不是 root 用户的密码)。

root@ubuntu:/home/lhj# ssh-keygen -t rsa -b 4096 -C "1003385198@qq.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa

Your public key has been saved in /root/.ssh/id_rsa.pub

The key fingerprint is:

SHA256:7T472hTUAv7hb894x4bocVbgcX7hhcP+2fPL3WkOMkI 1003385198@qq.com

The key's randomart image is:

+---RSA 4096----+

| . |

| . . . . . |

| . + . *.o|

| = o o.*o|

| SE= o.+|

| .. o o+|

| .oo+oo=o|

| ++.+B=.X|

| ..+=o.=B=|

+----SHA256-----+

相关推荐
小羊没烦恼!2 天前
初探性能优化——2个月到4小时的性能提升
java·开发语言·windows·算法·c#
rockmelodies2 天前
# Windows Server2008 R2 Standard(SP1镜像U盘)重置本地管理员密码【完整详细步骤】
windows·密码破解
未济2 天前
linux 配置环境变量
linux
傲世仙尊2 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫2 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.2 天前
进程间通信
linux
AI职业加油站2 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-052 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏2 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz2 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试