I am new to linux, when I typed "vi FILE1" I was able to open VI editor. I added some data and I want to save the file and I tried :w but it threw me an error.
"file1" E212: Can't open file for writing
Press ENTER or type command to continue
why I am not able to save it?
I read it some where that I need permissions for that. While installing ubantu... I created and User and password with which I login.
Wont that user have admin privilages? what do I have to do to go further?
1. Change the permissions of the file concerned so that other users can edit the file, e.g. create a new group (sudo groupadd newgroup), put the users who are to be allowed to edit the file into that group (sudo adduser user newgroup), make the file group owned by the new group (sudo chgrp newgroup FILE1) and make the file writeable by the group (sudo chmod g+w FILE1)
2, Even if you do not want to give your users access to sudo to do anything they like (very wise!) then you can allow users to edit this one file in particular as root by using sudo with or without providing these users having to provide a password, e.g. run visudo:
and enter the line:
Or to allow all users in a group (newgroup in this example) to edit the file then add:
Replace NOPASSWD with PASSWD if you want them to still provide their own password before being able to edit the file.
Note the full path to vi so the user cannot write a script called vi and run it as root and the file to be edited is also fully pathed.
The user (or users in newgroup) can then run:
to edit FILE1 as if they are the root user with or without having to provide a password depending on what you put into the sudoers file.
HTH
Last edited by TonyFullerMalv; 02-08-2010 at 06:24 PM..
You need a space after 'cp' and between the source and destination.
The destination can be either a file name or a directory[folder]
The source name can be absolute or relative to the current directory.
You need to have read permissions for the source file, and write permissions for the destination directory.
If I have a A.log
1 Air Flow Monitor : 34.070 Degrees C
2 Air Flow Monitor : 41.730 Degrees C
3 Air Flow Monitor : 35.340 Degrees C
4 Air Flow Monitor : 33.370 Degrees C
5 Air Flow Monitor : 36.770 Degrees C
6 Air Flow Monitor : 45.910 Degrees C
7 Air Flow Monitor ... (1 Reply)
My requirement is to read a column data from a file & save it in a variable for each row & process it. I am using the below code-
Leadlines="$TGTFILE/Error.txt">>$log_file
while read line
do
id = ` echo $line | cut -d "," -f1 `
email = ` echo $line | cut -d "," -f2 `
-----------
done
My... (2 Replies)
Hi Guys,
I have blank file A.txt
I will run the script xyz.sh
First i want to open a.txt file...
Now i will enter some data like
XYZ
ABC
PQR
..
Save it and keep continue my script....
END of my script.
Thanks (1 Reply)
Hi all;
I have the following code which gives me kind of what I need:
#!/usr/bin/perl
use Fcntl ':mode';
#
if ($ARGV ne "") {
$filename = $ARGV;
} else {
print "Please specify a file!\n";
exit;
}
#
if... (2 Replies)
Hi all,
I have just installed Solaris 10 on an old Fujitsu Primepower 650 which has been wiped clean. I haven't installed anything apart from the OS yet, so the machine is 99% idle.
I get long delays when logging in, first after entering the id then another long delay after entering a valid... (8 Replies)
Hi,
i have 2 input files which are file1.txt and file2.txt. I need to extract data from file1.txt and file2.txt and save it in file3.txt like example below:-
File1.txt
ID scrap1
Name scrap1
start 1
end 10
ID scrap2
Name scrap2
start 11
end ... (4 Replies)
i have a file,like
1 3
4 5
6 7
8 9
i want to save it into an array.
and then i want to get every element, because i want to use them to calculate. for example: i want to calculate 1 + 3.
but i cannot reach my goal.
open (FILE, "<", "number");
my @arr;
while (<FILE>){
chomp;... (1 Reply)
Hi
I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data.
I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Hi i have wriiten a script which fetches the data from text file, and saves in the output in a text file itself, but i want that the output should save in different columns.
I have the output like:
For Channel:response_time__24.txt
1547 data points
0.339
0.299
0.448
0.581
7.380
... (1 Reply)
Hello,
Our RAID and server recently crashed and we are trying to recover our data. The problem appears to be that the Veritas File System/Logical Volume Manger became corrupt on our RAID. We are down to our last option, which is to run some Veritas commands that "may" result in data loss.
... (1 Reply)