Tuesday, 3 September 2013

How to create a new file that requires sudo and write to it in bash?

How to create a new file that requires sudo and write to it in bash?

I need to create a new file and write to it in a specific location,
however, creating this file requires using sudo as otherwise it gives me
permission denied. Here is the data I want to put in the file
(hive-site.xml under /usr/local/hive/conf):
"<?xml version="1.0"?>\
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>\
<configuration>\
<property>\
<name>javax.jdo.option.ConnectionURL</name>\
<value>jdbc:derby:;databaseName=/usr/local/hive//metastore_db;create=true</value>\
<description>JDBC connect string for a JDBC metastore</description>\
</property>\
<property>\
<name>fs.default.name</name>\
<value>hdfs://master:54310</value>\
</property>\
<property>\
<name>mapred.job.tracker</name>\
<value>hdfs://master:54311</value>\
<description>The host and port that the MapReduce job tracker runs
at.
</description>\
<property>\
<name>hive.metastore.warehouse.dir</name>\
<value>/usr/local/hadoop/bin/hadoop/user/hive/warehouse </value>\
</property>\
</property>\
</configuration>"

No comments:

Post a Comment