<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Soul Of Free Loop &#187; root</title>
	<atom:link href="https://zohead.com/archives/tag/root/feed/" rel="self" type="application/rss+xml" />
	<link>https://zohead.com</link>
	<description>Uranus Zhou&#039;s Blog</description>
	<lastBuildDate>Sat, 19 Jul 2025 15:42:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>酷走行车记录仪root和GPS时间同步</title>
		<link>https://zohead.com/archives/kuzo-root-gps-time-sync/</link>
		<comments>https://zohead.com/archives/kuzo-root-gps-time-sync/#comments</comments>
		<pubDate>Sat, 26 Feb 2022 13:30:33 +0000</pubDate>
		<dc:creator><![CDATA[Uranus Zhou]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[SuperSU]]></category>
		<category><![CDATA[时间同步]]></category>
		<category><![CDATA[行车记录仪]]></category>
		<category><![CDATA[酷走]]></category>

		<guid isPermaLink="false">https://zohead.com/?p=1734</guid>
		<description><![CDATA[首先很惭愧我已经有一年多没有更新博客内容了，之前写过一篇 酷走 Android 行车记录仪研究 的文章，行车记录仪的 ADB 调试已经可以用起来了，不过还存在网络不可用时系统时间不正确的问题，刚好再研究一下行车记录仪的 root 以及通过 GPS 同步记录仪的系统时间。 root 系统 其实酷走这款 Android 行车记录仪系统已经自带了“假” root 权限，只是没有带 su 管理的工具。虽然 SuperSU 很久没更新了，我还是准备安装试试，首先从 SuperSU 官网下载最新 2.82 版本的刷机 zip 包： http://supersuroot.org/downloads/Supe [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>首先很惭愧我已经有一年多没有更新博客内容了，之前写过一篇 <a href="https://zohead.com/archives/kuzo-android-internal/" target="_blank">酷走 Android 行车记录仪研究</a> 的文章，行车记录仪的 ADB 调试已经可以用起来了，不过还存在网络不可用时系统时间不正确的问题，刚好再研究一下行车记录仪的 root 以及通过 GPS 同步记录仪的系统时间。</p>
<h2 id="root-system">root 系统</h2>
<p>其实酷走这款 Android 行车记录仪系统已经自带了“假” root 权限，只是没有带 su 管理的工具。虽然 SuperSU 很久没更新了，我还是准备安装试试，首先从 SuperSU 官网下载最新 2.82 版本的刷机 zip 包：</p>
<pre><code>http://supersuroot.org/downloads/SuperSU-v2.82-201705271822.zip
</code></pre>
<p>解压缩之后，首先使用 adb 命令将系统重新挂载为可读写状态：</p>
<pre class="brush: bash; title: ; notranslate">
~$ adb remount
</pre>
<p>参考之前折腾刷机的经验，先拷贝刷机 zip 包中的文件：</p>
<pre class="brush: bash; title: ; notranslate">
~$ adb push common/Superuser.apk /sdcard/
~$ adb push common/install-recovery.sh /sdcard/
~$ adb push x86/su /sdcard/
~$ adb push x86/supolicy /sdcard/
~$ adb push x86/libsupol.so /sdcard/
</pre>
<p>这个时候可以使用 <code>adb shell</code> 命令登录到行车记录仪，再将文件移动到系统目录：</p>
<pre class="brush: bash; title: ; notranslate">
root@Sf3gr_mrd6_p2_720# mkdir /system/app/SuperSU
root@Sf3gr_mrd6_p2_720# mv /sdcard/Superuser.apk /system/app/SuperSU/
root@Sf3gr_mrd6_p2_720# mv /sdcard/install-recovery.sh /system/bin/
root@Sf3gr_mrd6_p2_720# cp /sdcard/su /system/xbin/
root@Sf3gr_mrd6_p2_720# mkdir /system/bin/.ext
root@Sf3gr_mrd6_p2_720# cp /sdcard/su /system/bin/.ext/.su
root@Sf3gr_mrd6_p2_720# mv /sdcard/su /system/xbin/daemonsu
root@Sf3gr_mrd6_p2_720# mv /sdcard/supolicy /system/xbin/
root@Sf3gr_mrd6_p2_720# mv /sdcard/libsupol.so /system/lib/
</pre>
<p>还需要设置文件权限：</p>
<pre class="brush: bash; title: ; notranslate">
root@Sf3gr_mrd6_p2_720# chmod 0644 /system/app/SuperSU/Superuser.apk
root@Sf3gr_mrd6_p2_720# chmod 0755 /system/bin/install-recovery.sh /system/xbin/su /system/bin/.ext/.su /system/xbin/daemonsu /system/xbin/supolicy /system/lib/libsupol.so
root@Sf3gr_mrd6_p2_720# chcon u:object_r:system_file:s0 /system/app/SuperSU/Superuser.apk /system/bin/install-recovery.sh /system/xbin/su /system/bin/.ext/.su /system/xbin/daemonsu /system/xbin/supolicy /system/lib/libsupol.so
</pre>
<p>不过最后运行 SuperSu 安装命令的时候却出错了：</p>
<pre class="brush: bash; title: ; notranslate">
root@Sf3gr_mrd6_p2_720# /system/xbin/su --install
error: only position independent executables (PIE) are supported.
</pre>
<p>看来是想当然了，我拷贝的是非 PIE 格式的 su 程序导致运行不了。那就重新拷贝正确的 su 程序（需要使用 <code>su.pie</code> 地址无关的可执行程序版本），这次就 adb 命令一步到位了：</p>
<pre class="brush: bash; title: ; notranslate">
~$ adb push common/Superuser.apk /system/app/SuperSU/Superuser.apk
~$ adb push common/install-recovery.sh /system/bin/install-recovery.sh
~$ adb push x86/su.pie /system/xbin/su
~$ adb push x86/su.pie /system/bin/.ext/.su
~$ adb push x86/su.pie /system/xbin/daemonsu
~$ adb push x86/supolicy /system/xbin/supolicy
~$ adb push x86/libsupol.so /system/lib/libsupol.so
</pre>
<p>设置文件权限之后再重新执行 <code>/system/xbin/su --install</code> 命令安装就没有问题了，测试确认 SuperSU App 也可以正常运行了。</p>
<h2 id="gps-time-sync">GPS 时间同步</h2>
<p>为了能修正行车记录仪的系统时间，我在行车记录仪上安装了 <a href="https://play.google.com/store/apps/details?id=com.pautinanet.smarttimesync" target="_blank">Smart Time Sync</a> 这款 App 进行时间同步。Smart Time Sync 支持通过 GPS、NTP  或 HTTP 同步系统时间，不过行车记录仪上都没有装 SIM 卡更没有网络，只能通过 GPS 进行时间同步了。</p>
<p>如果 Android 系统没有 root，Smart Time Sync 只能进行手工同步，因此为了实际使用过程中能实现后台自动时间同步，上面的系统 root 操作还是必须的。</p>
<p>Smart Time Sync 运行效果如下：</p>
<p><img src="https://images.weserv.nl/?url=http://res.cloudinary.com/digwht2y0/image/upload/v1737372134/kuzo-smart-time-sync.png" alt="Smart Time Sync"></p>
<p>App 使用起来也很简单，首先在 Source 源选择 <code>GPS</code>，然后点 <code>Sync Time</code> 按钮就可以手工同步系统时间了，当然前提是设备必须放在有 GPS 信号的地方。</p>
<p>点击后面的设置图标就可以配置后台自动进行时间同步了，现在我的行车记录仪即使掉电了保存的录像文件时间也是正确的了。</p>
]]></content:encoded>
			<wfw:commentRss>https://zohead.com/archives/kuzo-root-gps-time-sync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下apache以root身份运行</title>
		<link>https://zohead.com/archives/linux-apache-root/</link>
		<comments>https://zohead.com/archives/linux-apache-root/#comments</comments>
		<pubDate>Thu, 28 Aug 2014 14:27:46 +0000</pubDate>
		<dc:creator><![CDATA[Uranus Zhou]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[BIG_SECURITY_HOLE]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[RPM]]></category>

		<guid isPermaLink="false">http://zohead.com/?p=781</guid>
		<description><![CDATA[最近在某个项目需求中需要在 Linux 下使 apache 以 root 身份运行（默认使用的是 apache 用户），直接修改 apache 配置文件 httpd.conf 中的运行身份为 User root 和 Group root 后启动 apache 结果会报下面的错误： Error: Apache has not been designed to serve pages while running as root. There are known race conditions that will allow any local user to read any file on th [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>最近在某个项目需求中需要在 Linux 下使 apache 以 root 身份运行（默认使用的是 apache 用户），直接修改 apache 配置文件 httpd.conf 中的运行身份为 User root 和 Group root 后启动 apache 结果会报下面的错误：</p>
<p>Error: Apache has not been designed to serve pages while running as root. There are known race conditions that will allow any local user to read any file on the system. If you still desire to serve pages as root then add -DBIG_SECURITY_HOLE to the EXTRA_CFLAGS line in your src/Configuration file and rebuild the server. It is strongly suggested that you instead modify the User directive in your httpd.conf file to list a non-root user.</p>
<p>看来 Linux 发行版中的 apache 因为安全原因默认就不允许以 root 身份运行了，必须修改编译选项 BIG_SECURITY_HOLE 重新编译安装 apache 才可以。</p>
<p>由于我使用的是 64 位的 RedHat Enterprise Linux 6 系统，考虑直接使用源代码 RPM 包的形式编译，我们实际上只需要替换 apache 的 httpd 这个二进制文件就可以启用 root 权限了，这样是最简单方便的方法了。</p>
<p>首先确认当前 apache 的版本：</p>
<p><strong>rpm -q httpd</strong><br />
<strong>httpd-2.2.15-9.el6.x86_64</strong></p>
<p>下载同样版本的 source rpm 包：</p>
<p><strong>cd /usr/src/redhat/SRPMS</strong><br />
<strong>wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/httpd-2.2.15-9.el6.src.rpm</strong></p>
<p>然后使用 rpm2cpio 命令解压缩 RPM 包：</p>
<p><strong>rpm2cpio httpd-2.2.15-9.el6.src.rpm | cpio -iduv</strong></p>
<p>接着从解压缩出来的源代码中可以看到源代码包：httpd-2.2.15-9.tar.bz2 还有一堆 patch 补丁文件，另外就是比较重要的编译配置文件 httpd.spec 了。</p>
<p>这时就可以修改 httpd.spec 文件中的编译选项了，根据最开始的提示找到 CFLAGS，并加上 BIG_SECURITY_HOLE 定义：</p>
<p><strong>CFLAGS="$RPM_OPT_FLAGS -Wformat-security -fno-strict-aliasing -DBIG_SECURITY_HOLE"</strong></p>
<p>保存退出，接着就可以直接使用 rpmbuild 命令直接编译出 RPM 包了：</p>
<p><strong>rpmbuild --ba httpd.spec</strong></p>
<p>稍微一会就可以找到编译出的 RPM 包了：</p>
<p>/root/rpmbuild/RPMS/x86_64/httpd-2.2.15-9.el6.x86_64.rpm</p>
<p>从编译出的 RPM 包里解压缩出 httpd、httpd.event、httpd.worker 这三个文件替换到 /usr/sbin 等目录下，再重启 httpd 服务就可以使用 root 身份运行 apache 了。</p>
]]></content:encoded>
			<wfw:commentRss>https://zohead.com/archives/linux-apache-root/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
