Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How Apply settings for multie users

Posted on 2009-06-30
5
Medium Priority
?
366 Views
Last Modified: 2013-12-16
For file association in linux after some RND i have achieved it

the below link helps me to achieve http://www.linuxquestions.org/questions/linuxquestions.org-member-success-stories-23/gnome-default-file-association-setting-464729/

But i am facing the new problem

ie. when i do file association for one user it will not affect to other user.
i am doing association from root user still not working
i am using KDE and GNOME
0
Comment
Question by:NaveenKhanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Assisted Solution

by:Siridivi
Siridivi earned 200 total points
ID: 24745047
This requires a lengthy response, so I'll refer  you to an article that goes through one method of how to do this.

http://forums.fedoraforum.org/archive/index.php/t-26875.html
0
 
LVL 2

Expert Comment

by:JabbaDow
ID: 24752346
I'm not sure if Fedora uses the same mechanism as Debian/Ubuntu, but on those systems, you can set up defaults for new users by copying the relevant .gnome and .kde directories from a working user account to /etc/skel. This would give new users the same default configurations as the user from which you copied the directories from. Again, this only applies to newly created users.
0
 

Author Comment

by:NaveenKhanna
ID: 24753065
hello Siridivi:

Thanks for your reply , the provided link is very help full but the steps given is not worked for me....
if u have any other method pls let me know.


hello
JabbaDow:

this is the manual work i have to do for every user is there any way tat make changes for one user(Root) and it should effect for all users.
0
 
LVL 2

Expert Comment

by:JabbaDow
ID: 24753111
Not that I know of, short of copying the .kde and .gnome folders from a reference user to all other users, which would change all gnome and kde settings. I don't know of a way to just change a file type association or similar. Perhaps if you could find the specific config file that contains the setting, you could grep through all the users' home folders and manually make the change from the command line or with a quick sed script.
0
 

Accepted Solution

by:
NaveenKhanna earned 0 total points
ID: 24837739
with the help of URL

http://forums.fedoraforum.org/archive/index.php/t-26875.html

in KDE using ControlCenter-->KDEComponents-->FileAssociation

while doing i noticed that this process will create 3 files
in respective directory

share/applnk/.hidden/RunApp.sh.desktop
share/config/profilerc
share/mimelnk/application/caux.desktop

where "RunApp.sh" is my Shell script file which will run my jar
where "caux." is my extension
profilerc is settings file which store the link information

these above three files are created when i use ControlCenter and it work fine for me...

to avoid manual work what i did is i have created a 3 files in respective path programitically using java here it is not working

my question is is thier any thing that i am missing to update are create programmatically













To create files the code written in java
 
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fileregister;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
 
/**
 *
 * @author root
 */
public class register {
 
    /**
     * @param args the command line arguments
     */
    register() {
 
        try {
            String t_KdeHome = "";
            String t_AppPath = "";
            String t_ProfilePath = "";
            String t_ApplinkPath = "";
            Process child = Runtime.getRuntime().exec("kde-config --localprefix");
 
            // hook up child process output to parent
            InputStream lsOut = child.getInputStream();
            InputStreamReader r = new InputStreamReader(lsOut);
            BufferedReader in = new BufferedReader(r);
 
            // read the child process' output
            String line;
            while ((line = in.readLine()) != null) {
                if (line.contains(".kde")) {
                    System.out.println(line + "\n");
                    t_KdeHome = line;
                }
            }
            t_AppPath = t_KdeHome + "share/applnk/.hidden/RunApp.sh.desktop";
                t_ProfilePath = t_KdeHome + "share/config/profilerc";
            t_ApplinkPath = t_KdeHome + "share/mimelnk/application/caux.desktop";
            String t_installPath = "/usr/CoralTools/RunApp.sh";
            StringBuilder t_AppFiletxt = new StringBuilder("[Desktop Entry]\n" +
                    "Comment=\n" +
                    "Hidden=false\n" +
                    "Icon=\n" +
                    "MimeType=application/caux\n" +
                    "Patterns=*.caux\n" +
                    "Type=MimeType");
            CreateFile(t_AppFiletxt.toString(), t_AppPath, true);
            t_AppFiletxt.delete(0, t_AppFiletxt.length());
            t_AppFiletxt.append("\n[application/caux - 1]\n" +
                    "AllowAsDefault=true\n" +
                    "Application=kde-RunApp.sh.desktop\n" +
                    "GenericServiceType=Application\n" +
                    "Preference=1\n" +
                    "ServiceType=application/caux\n");
 
            CreateFile(t_AppFiletxt.toString(), t_ProfilePath, false);
 
            t_AppFiletxt.delete(0, t_AppFiletxt.length());
            t_AppFiletxt.append("[Desktop Entry]\n" +
                    "Exec=" + t_installPath + "\n" +
                    "InitialPreference=1\n" +
                    "MimeType=application/caux\n" +
                    "Name=RunApp.sh\n" +
                    "Terminal=false\n" +
                    "Type=Application\n");
            CreateFile(t_AppFiletxt.toString(), t_ApplinkPath, true);
            
 
            
            
        } catch (IOException ex) {
            Logger.getLogger(register.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(null, ex.getMessage(), "SetUp Information", JOptionPane.OK_OPTION);
        }
    }
 
    private boolean CreateFile(String pContent, String pFilePath, boolean isNew) throws IOException {
        FileWriter t_Fw = null;
        FileOutputStream t_Fos = null;
        try {
            File t_File = new File(pFilePath);
            if (isNew) {
                if (t_File.exists()) {
                    t_File.delete();
                }
                if (t_File.createNewFile()) {
                    t_Fw = new FileWriter(t_File);
                    t_Fw.write(pContent.toString());
                    t_Fw.flush();
                }
            } else {
                t_Fos = new FileOutputStream(t_File, true);
                t_Fos.write(pContent.getBytes());
                t_Fos.flush();
            }
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "SetUp Information", JOptionPane.OK_OPTION);
            return false;
        } finally {
            if (t_Fos != null) {
                t_Fos.close();
            }
            if (t_Fw != null) {
                t_Fw.close();
            }
            return true;
        }
    }
 
    public static void main(String[] args) {
        new register();
    }
}

Open in new window

profilerc
caux.txt
RunApp.sh.txt
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question