大网数据广告活动
服务器运维问答

What is the ~/.rnd file in openssl and how to generate a new private key with it?

· 52CE 我爱测

When I tried to run the following command to issue a new private key, which I use to host my web app via SSL: openssl genrsa -out example.key 2048 the following error occured: unable to write 'random state' e is 65537 (0x10001) A…

问题原文

原帖链接 · Blaszard · CC BY-SA 3.0

When I tried to run the following command to issue a new private key, which I use to host my web app via SSL:

openssl genrsa -out example.key 2048

the following error occured:

unable to write 'random state'  
e is 65537 (0x10001)

After digging out on the Web, I found a solution, which instructs you to delete the ~/.rnd file, which is likely owned by root.

sudo rm ~/.rnd

However, I found you don't need to delete the ~/.rnd if you issue the openssl command with sudo.

So my question is:

  • what is the ~/.rnd and why does it exist in my environment?

  • Which is a better way to issue a new private key?

社区高分解答

原帖链接 · womble · CC BY-SA 3.0

The ~/.rnd file is owned by root if you've ever run a command that modifies ~/.rnd as root via sudo in its non-login mode (ie without -i). As for what the ~/.rnd file is, it contains a seed value for the OpenSSL random number generator. The least-worst docs I can find on it are the RAND_read_file(3) man page.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。